0% found this document useful (0 votes)
4 views8 pages

Wide Vision Util

The WideVisionUtil class manages settings for wide vision modes in games on Android, initializing a list of games and their respective settings. It provides methods to query and update game settings based on package names and various modes, while also handling the storage of these settings in the system's global settings. The class utilizes helper methods to create queries for specific games or all games, and updates the package list accordingly.

Uploaded by

enochcrc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Wide Vision Util

The WideVisionUtil class manages settings for wide vision modes in games on Android, initializing a list of games and their respective settings. It provides methods to query and update game settings based on package names and various modes, while also handling the storage of these settings in the system's global settings. The class utilizes helper methods to create queries for specific games or all games, and updates the package list accordingly.

Uploaded by

enochcrc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

package com.zui.ugame.gamesetting.ui.options.content.widevision.

data;

import android.content.ContentValues;
import android.content.Context;
import android.provider.Settings;
import android.util.Log;
import com.zui.game.service.features.touchsamplingrate.TouchSamplingRate;
import com.zui.game.service.util.ConstValueKt;
import com.zui.game.service.vibrate.VibrationToolKt;
import com.zui.ugame.gamesetting.ui.options.content.widevision.WideVisionGame;
import com.zui.ugame.gamesetting.ui.options.content.widevision.WideVisionMode;
import com.zui.ugame.gamesetting.ui.options.content.widevision.WideVisionState;
import com.zui.util.DeviceUtils;
import com.zui.util.SystemPropertiesKt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;

/* loaded from: classes3.dex */


public class WideVisionUtil {
private static final String ASPECTWIDE_MODE = "wide";
private static final String CENTERSET = "center";
private static final String DEEPWIDE_MODE = "deepwide";
private static final String DEF_VALUE_ASPECT_RATIO = "2.1";
private static final String DEF_VALUE_DEEP_WIDE = "1.2";
private static final String DEF_VALUE_EXTRA_WIDE = "2.4";
private static final String DOWNSET = "down";
private static final String EXTRAWIDE_MODE = "extreme";
private static final String FULLSCREEN_MODE = "full";
private static final String FULLWIDE_MODE = "fullwide";
private static final String Tag = "WideField";
private Context mContext;
private final HashMap<String, WideFieldApp> mGameList = new LinkedHashMap();
private final String[] verticalApps = {"com.happyelements.AndroidAnimal",
"com.kiloo.subwaysurf"};
public static final String COLUMN_GAME = "Game";
public static final String COLUMN_SETTING = "Setting";
public static final String COLUMN_PACKAGE = "Package";
public static final String COLUMN_MODE = "Mode";
public static final String[] COLUMNS = {COLUMN_GAME, COLUMN_SETTING,
COLUMN_PACKAGE, COLUMN_MODE};
private static final String DEF_VALUE_DEEP_WIDE_VERTICAL = "1.6";
private static String DEF_VALUE_ASPECT_RATIO_VERTICAL =
DEF_VALUE_DEEP_WIDE_VERTICAL;
private static String DEF_VALUE_EXTRA_WIDE_VERTICAL = "1.8";
private static final String DEF_VALUE_FULL_SCREEN_WIDE = null;

public WideVisionUtil(Context context) {


this.mContext = context;
initGameList();
}

private void initGameList() {


boolean isRow = DeviceUtils.INSTANCE.isRow();
this.mGameList.put(isRow ? VibrationToolKt.row_pubg1 :
"com.tencent.tmgp.pubgmhd", new WideFieldApp("和平精英", isRow ?
VibrationToolKt.row_pubg1 : "com.tencent.tmgp.pubgmhd", isRow ? "pubgmobile" :
"pubgmhd", null, null, DEF_VALUE_DEEP_WIDE, "1.8"));
this.mGameList.put(isRow ? "com.riotgames.league.wildrift" :
ConstValueKt.PKG_YXLM, new WideFieldApp("LGame", isRow ?
"com.riotgames.league.wildrift" : ConstValueKt.PKG_YXLM, isRow ? "lolwildrift" :
"lolm", DEF_VALUE_ASPECT_RATIO, DEF_VALUE_EXTRA_WIDE, null, null));
if (isRow) {
return;
}
this.mGameList.put("com.tencent.tmgp.sgame", new WideFieldApp("王者荣耀",
"com.tencent.tmgp.sgame", "sgame", DEF_VALUE_ASPECT_RATIO, DEF_VALUE_EXTRA_WIDE,
null, null));
}

public List<WideVisionGame> query(String path, String selection) {


ArrayList arrayList = new ArrayList();
Log.w(Tag, path == null ? "null" : path);
if (path == null) {
if (selection != null && selection.length() > 8) {
String[] split = selection.split("=");
return (split != null && split.length == 2 &&
split[0].equals("package")) ? createCursorForQueryPackage(split[1]) : arrayList;
}
return createCursorForQueryAll();
}
return createCursorForQuery(path);
}

public int update(String name, ContentValues values) {


Log.w(Tag, "name = $name" + name);
WideFieldApp appByName = getAppByName(name);
if (appByName == null) {
String str = (String) values.get(COLUMN_PACKAGE);
String str2 = (String) values.get(COLUMN_MODE);
if (str != null && !str.isEmpty()) {
WideFieldApp appByPkg = getAppByPkg(str);
if (appByPkg == null) {
Log.w(Tag, "update ContentValues Package--1 : " + str);
return 0;
}
String str3 = appByPkg.WideField;
if (str3 != null && !str3.isEmpty()) {
updateAppSetting(str, (String) values.get(COLUMN_SETTING),
appByPkg, str2);
return 1;
}
}
return 0;
}
updateAppSetting(appByName.pkg, (String) values.get(COLUMN_SETTING),
appByName, (String) values.get(COLUMN_MODE));
return 1;
}

private void updateAppSetting(String pkg, String setting, WideFieldApp app,


String mode) {
int i;
String str;
setting.hashCode();
char c = 65535;
switch (setting.hashCode()) {
case -1364013995:
if (setting.equals("center")) {
c = 0;
break;
}
break;
case 3089570:
if (setting.equals(DOWNSET)) {
c = 1;
break;
}
break;
case 3154575:
if (setting.equals(FULLSCREEN_MODE)) {
c = 2;
break;
}
break;
}
switch (c) {
case 0:
i = 1;
break;
case 1:
i = 2;
break;
case 2:
default:
i = 0;
break;
}
Log.w(Tag, "updateAppSetting mode : (" + mode + ")");
if (EXTRAWIDE_MODE.equals(mode) && app.ExtraWide != null) {
str = String.format("%d:%s", Integer.valueOf(i), app.ExtraWide);
Log.w(Tag, "extreme mode");
} else if (ASPECTWIDE_MODE.equals(mode) && app.AspectRatio != null) {
str = String.format("%d:%s", Integer.valueOf(i), app.AspectRatio);
Log.w(Tag, "wide mode");
} else if (FULLWIDE_MODE.equals(mode) && app.FullScreenWide != null) {
str = String.format("%d:%s", Integer.valueOf(i), app.FullScreenWide);
Log.w(Tag, "fullwide mode");
} else if (!DEEPWIDE_MODE.equals(mode) || app.DeepWide == null) {
str = "";
} else {
str = String.format("%d:%s", Integer.valueOf(i), app.DeepWide);
Log.w(Tag, "deepwide mode");
}
Log.w(Tag, "settingStr : " + str);
Settings.Global.putString(this.mContext.getContentResolver(),
"zui_ultra_wide_" + pkg.replaceAll("\\.", "_"), str);
updatePackageList();
}

private void updatePackageList() {


boolean z;
ArrayList<String> arrayList = new ArrayList();
Iterator<String> it = this.mGameList.keySet().iterator();
while (true) {
z = true;
if (!it.hasNext()) {
break;
}
String next = it.next();
String string =
Settings.Global.getString(this.mContext.getContentResolver(), "zui_ultra_wide_" +
next.replaceAll("\\.", "_"));
if (string != null && string.length() > 2) {
String substring = string.substring(0, 1);
if (substring.equals("1") || substring.equals("2")) {
arrayList.add(next);
}
}
}
if (arrayList.size() > 0) {
StringBuilder sb = new StringBuilder();
for (String str : arrayList) {
if (z) {
z = false;
} else {
sb.append(":");
}
sb.append(str);
}
Settings.System.putString(this.mContext.getContentResolver(),
"enable_wide_field_packages", sb.toString());
return;
}
Settings.System.putString(this.mContext.getContentResolver(),
"enable_wide_field_packages", "");
}

private List<WideVisionGame> createCursorForQuery(String game) {


Log.d(Tag, "createCursorForQuery: game = $" + game);
ArrayList arrayList = new ArrayList();
if (!this.mGameList.containsKey(game)) {
String[] split = game.split("\\.");
if (checkIsVerticalApp(game)) {
Log.d("@@dwj", "createCursorForQuery:
getSystemProperty(\"ro.product.system_ext.device\") = " +
SystemPropertiesKt.getSystemProperty("ro.product.system_ext.device"));
if (DeviceUtils.INSTANCE.isLGSIV()) {
DEF_VALUE_ASPECT_RATIO_VERTICAL = "0.8";
DEF_VALUE_EXTRA_WIDE_VERTICAL = "1.0";
}
this.mGameList.put(game, new WideFieldApp(split[split.length - 1],
game, split[split.length - 1], DEF_VALUE_ASPECT_RATIO_VERTICAL,
DEF_VALUE_EXTRA_WIDE_VERTICAL, DEF_VALUE_DEEP_WIDE_VERTICAL,
DEF_VALUE_FULL_SCREEN_WIDE));
} else {
this.mGameList.put(game, new WideFieldApp(split[split.length - 1],
game, split[split.length - 1], DEF_VALUE_ASPECT_RATIO, DEF_VALUE_EXTRA_WIDE,
DEF_VALUE_DEEP_WIDE, DEF_VALUE_FULL_SCREEN_WIDE));
}
}
WideFieldApp appByPkg = getAppByPkg(game);
if (appByPkg == null) {
return arrayList;
}
String str = appByPkg.pkg;
String string =
Settings.Global.getString(this.mContext.getContentResolver(), "zui_ultra_wide_" +
str.replaceAll("\\.", "_"));
if (string != null && string.length() > 2) {
String substring = string.substring(0, 1);
String substring2 = string.substring(2);
WideVisionState wideVisionState = WideVisionState.FULL;
WideVisionMode wideVisionMode = WideVisionMode.FULL;
Log.w(Tag, "addRow packageName:" + str + " set:" + substring + "
ratio:" + substring2);
substring.hashCode();
char c = 65535;
switch (substring.hashCode()) {
case 48:
if (substring.equals(TouchSamplingRate.sampling_close)) {
c = 0;
break;
}
break;
case 49:
if (substring.equals("1")) {
c = 1;
break;
}
break;
case 50:
if (substring.equals("2")) {
c = 2;
break;
}
break;
}
switch (c) {
case 0:
wideVisionState = WideVisionState.FULL;
break;
case 1:
wideVisionState = WideVisionState.CENTER;
break;
case 2:
wideVisionState = WideVisionState.DOWN;
break;
}
if (TouchSamplingRate.sampling_close.equals(substring)) {
wideVisionMode = WideVisionMode.FULL;
} else if (substring2.equals(appByPkg.ExtraWide)) {
wideVisionMode = WideVisionMode.EXTREME;
} else if (substring2.equals(appByPkg.AspectRatio)) {
wideVisionMode = WideVisionMode.WIDE;
} else if (substring2.equals(appByPkg.FullScreenWide)) {
wideVisionMode = WideVisionMode.FULLWIDE;
} else if (substring2.equals(appByPkg.DeepWide)) {
wideVisionMode = WideVisionMode.DEEPWIDE;
}
arrayList.add(new WideVisionGame(game, str, wideVisionMode,
wideVisionState));
Log.w(Tag, "addRow packageName:" + str + " setting:" + wideVisionState
+ " mode:" + wideVisionMode);
} else {
arrayList.add(new WideVisionGame(game, str, WideVisionMode.FULL,
WideVisionState.FULL));
Log.w(Tag, "addRow packageName:" + str + " setting:full mode:full");
}
return arrayList;
}

/* JADX WARN: Code restructure failed: missing block: B:38:0x00a4, code lost:
if (r11.equals("2") == false) goto L11; */
/* JADX WARN: Failed to find 'out' block for switch in B:16:0x00ba. Please
report as an issue. */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in
preferences
*/
private
java.util.List<com.zui.ugame.gamesetting.ui.options.content.widevision.WideVisionGa
me> createCursorForQueryAll() {
/*
Method dump skipped, instructions count: 394
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled:
com.zui.ugame.gamesetting.ui.options.content.widevision.data.WideVisionUtil.createC
ursorForQueryAll():java.util.List");
}

private List<WideVisionGame> createCursorForQueryPackage(String pkg) {


String str;
ArrayList arrayList = new ArrayList();
Log.w(Tag, "createCursorForQueryPackage:" + pkg);
if (!this.mGameList.containsKey(pkg)) {
String[] split = pkg.split("\\.");
Log.w(Tag, "tmp:" + split + "length:" + split.length);
this.mGameList.put(pkg, new WideFieldApp(split[split.length - 1], pkg,
split[split.length - 1], DEF_VALUE_ASPECT_RATIO, DEF_VALUE_EXTRA_WIDE,
DEF_VALUE_DEEP_WIDE, DEF_VALUE_FULL_SCREEN_WIDE));
}
Log.w(Tag, "mGameList:" + this.mGameList.keySet());
WideFieldApp appByPkg = getAppByPkg(pkg);
if (appByPkg != null && (str = appByPkg.WideField) != null && !
str.isEmpty()) {
String string =
Settings.Global.getString(this.mContext.getContentResolver(), "zui_ultra_wide_" +
pkg.replaceAll("\\.", "_"));
if (string != null && string.length() > 2) {
String substring = string.substring(0, 1);
String substring2 = string.substring(2);
WideVisionState wideVisionState = WideVisionState.FULL;
WideVisionMode wideVisionMode = WideVisionMode.FULL;
substring.hashCode();
char c = 65535;
switch (substring.hashCode()) {
case 48:
if (substring.equals(TouchSamplingRate.sampling_close)) {
c = 0;
break;
}
break;
case 49:
if (substring.equals("1")) {
c = 1;
break;
}
break;
case 50:
if (substring.equals("2")) {
c = 2;
break;
}
break;
}
switch (c) {
case 0:
wideVisionState = WideVisionState.FULL;
break;
case 1:
wideVisionState = WideVisionState.CENTER;
break;
case 2:
wideVisionState = WideVisionState.DOWN;
break;
}
if (TouchSamplingRate.sampling_close.equals(substring)) {
wideVisionMode = WideVisionMode.FULL;
} else if (substring2.equals(appByPkg.ExtraWide)) {
wideVisionMode = WideVisionMode.EXTREME;
} else if (substring2.equals(appByPkg.AspectRatio)) {
wideVisionMode = WideVisionMode.WIDE;
} else if (substring2.equals(appByPkg.FullScreenWide)) {
wideVisionMode = WideVisionMode.FULLWIDE;
} else if (substring2.equals(appByPkg.DeepWide)) {
wideVisionMode = WideVisionMode.DEEPWIDE;
}
arrayList.add(new WideVisionGame(str, pkg, wideVisionMode,
wideVisionState));
} else {
arrayList.add(new WideVisionGame(str, pkg, WideVisionMode.FULL,
WideVisionState.FULL));
}
}
return arrayList;
}

/* JADX INFO: Access modifiers changed from: package-private */


/* loaded from: classes3.dex */
public class WideFieldApp {
public String AspectRatio;
public String DeepWide;
public String ExtraWide;
public String FullScreenWide;
public String WideField;
public String name;
public String pkg;
public WideFieldApp(String name, String pkg, String wideField, String
aspectRatio, String extraWide, String deepWide, String fullScreenWide) {
this.name = name;
this.pkg = pkg;
this.WideField = wideField;
this.AspectRatio = aspectRatio;
this.ExtraWide = extraWide;
this.DeepWide = deepWide;
this.FullScreenWide = fullScreenWide;
}
}

private WideFieldApp getAppByPkg(String pkg) {


for (String str : this.mGameList.keySet()) {
if (str.equals(pkg)) {
return this.mGameList.get(str);
}
}
return null;
}

private WideFieldApp getAppByName(String name) {


for (String str : this.mGameList.keySet()) {
if (this.mGameList.get(str).WideField.equals(name)) {
return this.mGameList.get(str);
}
}
return null;
}

private boolean checkIsVerticalApp(String game) {


for (String str : this.verticalApps) {
if (str.equals(game)) {
return true;
}
}
return false;
}
}

You might also like