1.4.0530 默认隐藏爱优读机型apk,首次开机打开爱优读

This commit is contained in:
2024-05-31 09:45:58 +08:00
parent 7a07105d15
commit 08fd02bf93
7 changed files with 58 additions and 20 deletions

View File

@@ -29,8 +29,8 @@ android {
defaultConfig { defaultConfig {
applicationId "com.aoleyun.sn" applicationId "com.aoleyun.sn"
versionCode 134 versionCode 135
versionName "1.4.0529" versionName "1.4.0530"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature. //There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24 minSdkVersion 24

View File

@@ -30,7 +30,7 @@ public class CommonConfig {
/*首次启动app*/ /*首次启动app*/
public final static String FIRST_STARTUP = "app_first_startup"; public final static String FIRST_STARTUP = "app_first_startup";
/** /**
* 设备是否首次启动 * 设备是否首次启动 0首次 1非首次
*/ */
public final static String DEVICES_FRIST_START = "DEVICES_FRIST_START"; public final static String DEVICES_FRIST_START = "DEVICES_FRIST_START";

View File

@@ -26,10 +26,10 @@ public class AoleyunActivityController extends IActivityController.Stub {
@Override @Override
public boolean activityResuming(String pkg) { public boolean activityResuming(String pkg) {
Log.e(TAG, "activityResuming: " + pkg); Log.e(TAG, "activityResuming: " + pkg);
String default_launcher = mMMKV.decodeString(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, ""); // String default_launcher = mMMKV.decodeString(CommonConfig.DEFAULT_LAUNCHER_PACKAGE_NAME, "");
if (default_launcher.equals(pkg)) { // if (default_launcher.equals(pkg)) {
return false; // return false;
} // }
return true; return true;
} }

View File

@@ -1600,12 +1600,12 @@ public class NetInterfaceManager {
try { try {
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案 // TODO: 2021/5/24 需要后端替换包名,暂时解决方案
if ("com.mediatek.camera".equals(pack)) { if ("com.mediatek.camera".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp("com.android.camera2");
} }
if ("com.android.mms".equals(pack)) { if ("com.android.mms".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp("com.android.messaging");
} }
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp(pack);
Log.e("getDesktopIcon", pack); Log.e("getDesktopIcon", pack);
} catch (Exception e) { } catch (Exception e) {
Log.e("getDesktopIcon", "Exception: " + e.getMessage()); Log.e("getDesktopIcon", "Exception: " + e.getMessage());
@@ -1655,25 +1655,28 @@ public class NetInterfaceManager {
PackageManager pm = mContext.getPackageManager(); PackageManager pm = mContext.getPackageManager();
for (String pack : newList) { for (String pack : newList) {
try { try {
// TODO: 2021/5/24 需要后端替换包名,暂时解决方案
if ("com.mediatek.camera".equals(pack)) { if ("com.mediatek.camera".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.camera2", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp("com.android.camera2");
} }
if ("com.android.mms".equals(pack)) { if ("com.android.mms".equals(pack)) {
pm.setApplicationEnabledSetting("com.android.messaging", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp("com.android.messaging");
} }
pm.setApplicationEnabledSetting(pack, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp(pack);
Log.e("getDesktopIcon", pack); Log.e("getDesktopIcon", pack);
} catch (Exception e) { } catch (Exception e) {
Log.e("getDesktopIcon", "Exception: " + e.getMessage()); Log.e("getDesktopIcon", "Exception: " + e.getMessage());
} }
} }
} else { } else {
cacheHelper.put(UrlAddress.GET_HIDE_DESKTOPICON, ""); cacheHelper.put(UrlAddress.GET_HIDE_DESKTOPICON, "");
} }
} else { } else {
cacheHelper.put(UrlAddress.GET_HIDE_DESKTOPICON, ""); cacheHelper.put(UrlAddress.GET_HIDE_DESKTOPICON, "");
} }
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
ApkUtils.HideAiUDuApp();
}
} }
@Override @Override

View File

@@ -421,6 +421,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
} }
} }
if ("Aiud_A8_ag_1095".equals(Build.MODEL)) {
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 0) == 0) {
ApkUtils.openPackage(MainService.this, "com.books.wisdom");
}
ApkUtils.HideAiUDuApp();
}
// RoleManager mRm = getSystemService(RoleManager.class); // RoleManager mRm = getSystemService(RoleManager.class);
// mRm.addOnRoleHoldersChangedListenerAsUser(new Executor() { // mRm.addOnRoleHoldersChangedListenerAsUser(new Executor() {
// @Override // @Override
@@ -446,7 +454,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
// } // }
try { try {
getPackageManager().setApplicationEnabledSetting("com.android.email", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); JGYUtils.getInstance().hideApp("com.android.email");
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "onCreate: " + e.getMessage()); Log.e(TAG, "onCreate: " + e.getMessage());
} }
@@ -495,13 +503,15 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
Log.e(TAG, "setActivityController: " + e.getMessage()); Log.e(TAG, "setActivityController: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
mMMKV.encode(CommonConfig.DEVICES_FRIST_START, 1);
} }
@Override @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.e(TAG, "onStartCommand: "); Log.e(TAG, "onStartCommand: ");
JGYUtils.getInstance().wakeUpAoleyunAPP(); JGYUtils.getInstance().wakeUpAoleyunAPP();
if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 1) == 0) { if (mMMKV.decodeInt(CommonConfig.DEVICES_FRIST_START, 0) == 0) {
if (!checkAoleyunApp()) { if (!checkAoleyunApp()) {
Log.e(TAG, "onStartCommand: " + "checkAoleyunApp"); Log.e(TAG, "onStartCommand: " + "checkAoleyunApp");
// mPresenter.checkAoleyunUpdate(); // mPresenter.checkAoleyunUpdate();

View File

@@ -62,6 +62,8 @@ import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.schedulers.Schedulers;
public class ApkUtils { public class ApkUtils {
private static final String TAG = ApkUtils.class.getSimpleName();
public static final Set<String> aoleyunAPP = new HashSet<String>() {{ public static final Set<String> aoleyunAPP = new HashSet<String>() {{
this.add(BuildConfig.APPLICATION_ID); this.add(BuildConfig.APPLICATION_ID);
this.add("com.aoleyun.appstore"); this.add("com.aoleyun.appstore");
@@ -412,7 +414,6 @@ public class ApkUtils {
this.add("com.ygyb.yischool"); this.add("com.ygyb.yischool");
this.add("com.gaomuxuexi34"); this.add("com.gaomuxuexi34");
this.add("com.books.wisdom");
}}; }};
@@ -499,7 +500,31 @@ public class ApkUtils {
this.add("com.gl.dongwa"); this.add("com.gl.dongwa");
}}; }};
private static String TAG = ApkUtils.class.getSimpleName(); /*爱优读需要隐藏的图标*/
private static final HashSet<String> AiudHideApp = new HashSet<String>() {{
this.add("com.android.email");
this.add("com.android.soundrecorder");
this.add("com.android.documentsui");
this.add("com.mediatek.camera");
this.add("com.aoleyun.browser");
this.add("com.android.music");
this.add("com.android.fmradio");
this.add("com.android.gallery3d");
this.add("com.android.calendar");
this.add("com.android.calculator2");
this.add("com.android.deskclock");
this.add("com.android.contacts");
this.add("com.android.mms");
this.add("com.android.dialer");
this.add("com.android.stk");
}};
public static void HideAiUDuApp() {
Log.e(TAG, "HideAiUDuApp: ");
for (String s : AiudHideApp) {
JGYUtils.getInstance().hideApp(s);
}
}
public static synchronized boolean getRootAhth() { public static synchronized boolean getRootAhth() {
Process process = null; Process process = null;
@@ -1156,8 +1181,7 @@ public class ApkUtils {
List<PackageInfo> packages = pm.getInstalledPackages(PackageManager.COMPONENT_ENABLED_STATE_ENABLED | PackageManager.COMPONENT_ENABLED_STATE_DISABLED); List<PackageInfo> packages = pm.getInstalledPackages(PackageManager.COMPONENT_ENABLED_STATE_ENABLED | PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
for (PackageInfo packageInfo : packages) { for (PackageInfo packageInfo : packages) {
String pkg = packageInfo.packageName; String pkg = packageInfo.packageName;
Log.i(TAG, "showAllApp: " + pkg); Log.e(TAG, "showAllApp: " + pkg + " disable = " + (pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED));
Log.e(TAG, "showAllApp: disable = " + (pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED));
if (canremove_systemapp.contains(pkg) if (canremove_systemapp.contains(pkg)
&& !show_canremove_systemapp.contains(pkg)) { && !show_canremove_systemapp.contains(pkg)) {
Log.e(TAG, "showAllApp: continue: " + pkg); Log.e(TAG, "showAllApp: continue: " + pkg);

View File

@@ -1286,6 +1286,7 @@ public class JGYUtils {
this.add("com.alarmclock.uiui"); this.add("com.alarmclock.uiui");
this.add("com.uiui.videoplayer"); this.add("com.uiui.videoplayer");
this.add("com.ygyb.yischool"); this.add("com.ygyb.yischool");
this.add("com.books.wisdom");
}}; }};
private Set<String> getWhitePkgList() { private Set<String> getWhitePkgList() {