diff --git a/app/build.gradle b/app/build.gradle index 58f9ee1..1c6f019 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,8 +29,8 @@ android { defaultConfig { applicationId "com.aoleyun.sn" - versionCode 188 - versionName "1.5.0723" + versionCode 192 + versionName "1.5.0821" //There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature. minSdkVersion 24 @@ -255,9 +255,32 @@ android { v1SigningEnabled true v2SigningEnabled true } + + MT6765 { + storeFile file("keystore/MT6765.keystore") + storePassword "123456" + keyAlias "mt6765" + keyPassword "123456" + v1SigningEnabled true + v2SigningEnabled true + } } buildTypes { + MT6765Debug.initWith(debug) + MT6765Debug { + buildConfigField "String", "platform", '"MT6765"' + versionNameSuffix "-debug" + debuggable true + signingConfig signingConfigs.MT6765 + } + + MT6765Release.initWith(release) + MT6765Release { + buildConfigField "String", "platform", '"MT6765"' + signingConfig signingConfigs.MT6765 + } + QZ15Debug.initWith(debug) QZ15Debug { buildConfigField "String", "platform", '"QZA15"' diff --git a/app/keystore/MT6765.keystore b/app/keystore/MT6765.keystore new file mode 100644 index 0000000..bd34e90 Binary files /dev/null and b/app/keystore/MT6765.keystore differ diff --git a/app/src/main/java/com/aoleyun/sn/activity/main/MainActivity.java b/app/src/main/java/com/aoleyun/sn/activity/main/MainActivity.java index 7f46a2e..da85611 100644 --- a/app/src/main/java/com/aoleyun/sn/activity/main/MainActivity.java +++ b/app/src/main/java/com/aoleyun/sn/activity/main/MainActivity.java @@ -188,13 +188,13 @@ public class MainActivity extends BaseMvvmActivity lifecycle, onCompleteCallback callback) { - Observable> infoUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(BuildConfig.APPLICATION_ID, JgyUtils.getInstance().checkAppPlatform()); - Observable> storeUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.APPSTORE, JgyUtils.getInstance().checkAppPlatform()); + Observable> infoUpdateObservable = getUpdateApi().getUpdate(BuildConfig.APPLICATION_ID, JgyUtils.getInstance().checkAppPlatform()); + Observable> storeUpdateObservable = getUpdateApi().getUpdate(PackageNames.APPSTORE, JgyUtils.getInstance().checkAppPlatform()); Observable> desktopUpdateObservable; if (JgyUtils.getInstance().isAiuduPlatform()) { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform()); } else if (JgyUtils.isAllWinnerDevice()) { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.NEUTRAL_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); } else { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform()); } - Observable> notifyUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JgyUtils.getInstance().checkAppPlatform()); - Observable> browserUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.BROWSER, JgyUtils.getInstance().checkAppPlatform()); - Observable> learningDesktopObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.LEARNING_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); - Observable> ailogUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.AILOG, JgyUtils.getInstance().checkAppPlatform()); + Observable> notifyUpdateObservable = getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JgyUtils.getInstance().checkAppPlatform()); + Observable> browserUpdateObservable = getUpdateApi().getUpdate(PackageNames.BROWSER, JgyUtils.getInstance().checkAppPlatform()); + Observable> learningDesktopObservable = getUpdateApi().getUpdate(PackageNames.LEARNING_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + Observable> ailogUpdateObservable = getUpdateApi().getUpdate(PackageNames.AILOG, JgyUtils.getInstance().checkAppPlatform()); Observable.zip(infoUpdateObservable, storeUpdateObservable, desktopUpdateObservable, notifyUpdateObservable, browserUpdateObservable, ailogUpdateObservable, @@ -1039,30 +1032,23 @@ public class NetInterfaceManager { } public void checkAoleyunUpdate(BehaviorSubject lifecycle, UpdateCallback callback) { - Observable> infoUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(BuildConfig.APPLICATION_ID, JgyUtils.getInstance().checkAppPlatform()); - Observable> storeUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.APPSTORE, JgyUtils.getInstance().checkAppPlatform()); + Observable> infoUpdateObservable = getUpdateApi().getUpdate(BuildConfig.APPLICATION_ID, JgyUtils.getInstance().checkAppPlatform()); + Observable> storeUpdateObservable = getUpdateApi().getUpdate(PackageNames.APPSTORE, JgyUtils.getInstance().checkAppPlatform()); Observable> desktopUpdateObservable; if (JgyUtils.getInstance().isAiuduPlatform()) { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.AIUDUDESKTOP, JgyUtils.getInstance().checkAppPlatform()); } else if (JgyUtils.isAllWinnerDevice()) { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.ALLWINNER_15_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.NEUTRAL_DESKTOP, JgyUtils.getInstance().checkAppPlatform()); } else { - desktopUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform()); + desktopUpdateObservable = getUpdateApi().getUpdate(PackageNames.DESKTOP, JgyUtils.getInstance().checkAppPlatform()); } - Observable> notifyUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JgyUtils.getInstance().checkAppPlatform()); - Observable> browserUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.BROWSER, JgyUtils.getInstance().checkAppPlatform()); - Observable> ailogUpdateObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(PackageNames.AILOG, JgyUtils.getInstance().checkAppPlatform()); + Observable> notifyUpdateObservable = getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JgyUtils.getInstance().checkAppPlatform()); + Observable> browserUpdateObservable = getUpdateApi().getUpdate(PackageNames.BROWSER, JgyUtils.getInstance().checkAppPlatform()); + Observable> ailogUpdateObservable = getUpdateApi().getUpdate(PackageNames.AILOG, JgyUtils.getInstance().checkAppPlatform()); String desktop = mMMKV.decodeString(CommonConfig.DEFAULT_DESKTOP_PACKAGE); - Observable> learningDesktopObservable = NetInterfaceManager.getInstance() - .getUpdateApi().getUpdate(desktop, JgyUtils.getInstance().checkAppPlatform()); + Observable> learningDesktopObservable = getUpdateApi().getUpdate(desktop, JgyUtils.getInstance().checkAppPlatform()); Observable.zip(infoUpdateObservable, storeUpdateObservable, desktopUpdateObservable, notifyUpdateObservable, browserUpdateObservable, learningDesktopObservable, ailogUpdateObservable, @@ -2500,6 +2486,8 @@ public class NetInterfaceManager { ) { JgyUtils.getInstance().showApp(PackageNames.YIXUEPAI_DESKTOP); JgyUtils.getInstance().setYxpDefaultDesktop(); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + JgyUtils.getInstance().setDefaultDesktop("com.aly.os"); } Settings.System.putInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED); // Settings.System.putInt(mContext.getContentResolver(), CommonConfig.AOLE_APP_ALLOW_INSTALL, 0); @@ -2770,6 +2758,8 @@ public class NetInterfaceManager { tagSets.add(JgyUtils.seewoTag); } else if (platform == JgyUtils.U1302Platform) { tagSets.add(JgyUtils.allwinner_U1302); + } else if (platform == JgyUtils.MT6765Platform) { + tagSets.add(JgyUtils.MT6765_TAG); } }); @@ -4070,8 +4060,7 @@ public class NetInterfaceManager { Log.e("sendAppUsedTime", e.getMessage()); } - NetInterfaceManager.getInstance() - .getAppLogApi() + getAppLogApi() .getAppLog(Utils.getSerial(mContext), random, data.toString()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -4187,7 +4176,7 @@ public class NetInterfaceManager { public void getPublicIp(BehaviorSubject lifecycle, PublicIpCallbak callbak) { Retrofit retrofit = new Retrofit.Builder() - .client(NetInterfaceManager.getInstance().getOkHttpClient()) + .client(getOkHttpClient()) .baseUrl(UrlAddress.PCONLINE_WHOIS) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) diff --git a/app/src/main/java/com/aoleyun/sn/service/main/MainSPresenter.java b/app/src/main/java/com/aoleyun/sn/service/main/MainSPresenter.java index 0babf8f..16d2fe9 100644 --- a/app/src/main/java/com/aoleyun/sn/service/main/MainSPresenter.java +++ b/app/src/main/java/com/aoleyun/sn/service/main/MainSPresenter.java @@ -109,7 +109,7 @@ public class MainSPresenter implements MainSContact.Presenter { @Override public void setPushTags() { - NetInterfaceManager.getInstance().setPushTags(false, getLifecycle(), new NetInterfaceManager.PushTagCallback() { + NetInterfaceManager.getInstance().setPushTags( getLifecycle(), new NetInterfaceManager.PushTagCallback() { @Override public void setPushTag(String tag) { mView.setTagsFinish(TextUtils.isEmpty(tag)); diff --git a/app/src/main/java/com/aoleyun/sn/utils/ApkUtils.java b/app/src/main/java/com/aoleyun/sn/utils/ApkUtils.java index 3eb4582..02dbefe 100644 --- a/app/src/main/java/com/aoleyun/sn/utils/ApkUtils.java +++ b/app/src/main/java/com/aoleyun/sn/utils/ApkUtils.java @@ -74,6 +74,7 @@ public class ApkUtils { this.add("com.aoleyun.info"); this.add("com.aoleyun.audos"); this.add("com.aoleyun.os"); + this.add("com.aly.os"); this.add("com.aoleyun.ailog"); this.add("com.aoleyun.browser"); this.add("com.uiui.filecloud"); diff --git a/app/src/main/java/com/aoleyun/sn/utils/JgyUtils.java b/app/src/main/java/com/aoleyun/sn/utils/JgyUtils.java index f92a7a1..4a985ad 100644 --- a/app/src/main/java/com/aoleyun/sn/utils/JgyUtils.java +++ b/app/src/main/java/com/aoleyun/sn/utils/JgyUtils.java @@ -13,6 +13,7 @@ import android.content.ContextWrapper; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; +import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -163,6 +164,7 @@ public class JgyUtils { public static final int P50Platform = 23; public static final int seewoPlatform = 25; public static final int U1302Platform = 26; + public static final int MT6765Platform = 28; public static final String Other = "其他"; @@ -186,6 +188,7 @@ public class JgyUtils { public static final String P50Tag = "P50TD"; public static final String seewoTag = "seewo"; public static final String allwinner_U1302 = "QZA15"; + public static final String MT6765_TAG = "MT6765"; private CacheHelper cacheHelper; @@ -331,6 +334,9 @@ public class JgyUtils { } else if (allwinner_U1302.equalsIgnoreCase(platform)) { Log.i(TAG, "checkAppPlatform: " + "U1302"); return U1302Platform; + } else if (MT6765_TAG.equalsIgnoreCase(platform)) { + Log.i(TAG, "checkAppPlatform: " + "MT6765"); + return MT6765Platform; } else { Log.i(TAG, "checkAppPlatform: " + "没有数据"); return UnknowPlatform; @@ -393,6 +399,8 @@ public class JgyUtils { getAppPlatformCallback.AppPlatform(seewoPlatform); } else if (allwinner_U1302.equalsIgnoreCase(platform)) { getAppPlatformCallback.AppPlatform(U1302Platform); + } else if (MT6765_TAG.equalsIgnoreCase(platform)) { + getAppPlatformCallback.AppPlatform(MT6765Platform); } else { getAppPlatformCallback.AppPlatform(UnknowPlatform); } @@ -1391,7 +1399,7 @@ public class JgyUtils { if (TextUtils.isEmpty(data)) { Log.e(TAG, "SettingSysData: " + "data is empty"); int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED); - if (locked==JGYActions.FRAME_CODE_LOCKED) { + if (locked == JGYActions.FRAME_CODE_LOCKED) { SysSettingUtils.setDisableSetting(mContext); } SPUtils.put(mContext, JGYActions.ACTION_STATUSBAR_STATUS, ""); @@ -2095,11 +2103,11 @@ public class JgyUtils { Log.e(TAG, "setDeveloperOptions: state = " + state); int oldStatu = Settings.System.getInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0); - if (oldStatu == state) { + if (oldStatu == (state ^ 1)) { Log.e(TAG, "setDeveloperOptions: oldStatu = " + oldStatu + " no changed"); } //这个需要反着来 - Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state); + Settings.System.putInt(crv, CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, state ^ 1); Log.e(TAG, "setDeveloperOptions: DEVELOPMENT_SETTINGS_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0)); Log.e(TAG, "setDeveloperOptions: ADB_ENABLED = " + Settings.Global.getInt(crv, Settings.Global.ADB_ENABLED, 0)); @@ -2233,6 +2241,9 @@ public class JgyUtils { case JgyUtils.ZhanruiPlatform: intent.setComponent(new ComponentName("com.cube.update", "com.cube.update.GoogleOtaClient")); break; + case JgyUtils.MT6765Platform: + intent.setComponent(new ComponentName("com.waterworld.update", "com.waterworld.update.GoogleOtaClient")); + break; } try { mContext.startActivity(intent); @@ -2531,6 +2542,9 @@ public class JgyUtils { private String schoolosOs = "com.schoolos.cmcc"; private String schoolosClass = "com.schoolos.cmcc.activity.main.MainActivity"; + private String AlyOs = "com.aly.os"; + private String AlyOsClass = "com.aly.os.Launcher"; + public void setDefaultLauncher(Context context, String defPackageName, String defClassName) { try { if (!TextUtils.isEmpty(defPackageName) && !TextUtils.isEmpty(defClassName)) { @@ -2561,6 +2575,27 @@ public class JgyUtils { } } + public void setDefaultLauncher2(Context context, String pkg, String cls) { + PackageManager pm = context.getPackageManager(); + ComponentName component = new ComponentName(pkg, cls); + + // 创建 IntentFilter + IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN); + filter.addCategory(Intent.CATEGORY_HOME); + filter.addCategory(Intent.CATEGORY_DEFAULT); + + // 获取所有支持 HOME 的 Activity + List homeApps = pm.queryIntentActivities(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0); + ComponentName[] components = new ComponentName[homeApps.size()]; + for (int i = 0; i < homeApps.size(); i++) { + ActivityInfo ai = homeApps.get(i).activityInfo; + components[i] = new ComponentName(ai.packageName, ai.name); + } + + // 替换默认桌面 + pm.replacePreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY, components, component); + } + public void setRoleHolderAsUser(Context context, String packageName) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { String roleName = "android.app.role.HOME"; @@ -2604,10 +2639,14 @@ public class JgyUtils { || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G11JPlatform ) { JgyUtils.getInstance().setAiuduDefaultDesktop(); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + setDefaultDesktop(AlyOs, AlyOsClass); } } else { if (pkg.equalsIgnoreCase(desktopPkg)) { setDefaultDesktop(pkg); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + setDefaultDesktop(AlyOs, AlyOsClass); } } } @@ -2702,6 +2741,8 @@ public class JgyUtils { setDefaultDesktop(AiUDuOs, AiUDuOsClass); } else if (JgyUtils.isAllWinnerDevice()) { setDefaultDesktop(schoolosOs, schoolosClass); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + setDefaultDesktop(AlyOs, AlyOsClass); } else { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) { setDefaultDesktop(Launcher3, Launcher3QuickstepClass); @@ -2716,11 +2757,17 @@ public class JgyUtils { || "C2".equals(Build.MODEL)) { ApkUtils.openPackage(mContext, AoleyunOs, AoleyunOsClass); } else if (JgyUtils.getInstance().isAiuduPlatform()) { - setDefaultDesktop(AiUDuOs, AiUDuOsClass); + ApkUtils.openPackage(mContext, AiUDuOs, AiUDuOsClass); } else if (JgyUtils.isAllWinnerDevice()) { - setDefaultDesktop(schoolosOs, schoolosClass); + ApkUtils.openPackage(mContext, schoolosOs, schoolosClass); + } else if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform) { + ApkUtils.openPackage(mContext, AlyOs, AlyOsClass); } else { - ApkUtils.openPackage(mContext, Launcher3, Launcher3Class); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) { + ApkUtils.openPackage(mContext, Launcher3, Launcher3QuickstepClass); + } else { + ApkUtils.openPackage(mContext, Launcher3, Launcher3Class); + } } } @@ -2761,9 +2808,12 @@ public class JgyUtils { } public void setDefaultDesktop(String pkg, String className) { + Log.e(TAG, "setDefaultDesktop: pkg=" + pkg + " className=" + className); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { setRoleHolderAsUser(mContext, pkg); Log.e(TAG, "setDefaultDesktop: setRoleHolderAsUser"); + } else if (Build.VERSION.SDK_INT >= 31) { + setDefaultLauncher(mContext, pkg, className); } else { //爱华设置,暂时屏蔽 // setDefaultLauncher(mContext, pkg, className); diff --git a/app/src/main/java/com/aoleyun/sn/utils/Utils.java b/app/src/main/java/com/aoleyun/sn/utils/Utils.java index c400adf..0bb1d14 100644 --- a/app/src/main/java/com/aoleyun/sn/utils/Utils.java +++ b/app/src/main/java/com/aoleyun/sn/utils/Utils.java @@ -797,17 +797,17 @@ public class Utils { * @return */ public static String getSerial(Context context) { - if ("HL500".equals(Build.MODEL)) { + if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.HL500Platform) { return getIMEI(context); } if (TECLAST_BRAND.equalsIgnoreCase(Build.BRAND)) { return getPushMac(context); } else { - if (NOSN.equalsIgnoreCase(getSn())) { - return getIMEI(context); - } else { +// if (NOSN.equalsIgnoreCase(getSn())) { +// return getIMEI(context); +// } else { return getSn(); - } +// } } } @@ -1830,6 +1830,7 @@ public class Utils { || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.P50Platform || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.seewoPlatform || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.U1302Platform + || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.MT6765Platform ) { return Utils.getProperty("ro.build.display.id", "获取失败"); } else { diff --git a/app/src/main/res/layout-port/activity_main.xml b/app/src/main/res/layout-port/activity_main.xml index 2faacd3..230ba40 100644 --- a/app/src/main/res/layout-port/activity_main.xml +++ b/app/src/main/res/layout-port/activity_main.xml @@ -194,7 +194,7 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - android:visibility="@{appSettings==null||appSettings.custom_batch_control==0?View.GONE:View.VISIBLE}"> + >