Loading services/core/java/com/android/server/pm/AppStateController.java +13 −73 Original line number Diff line number Diff line Loading @@ -65,79 +65,19 @@ public class AppStateController { mPm = pm; mUserId = Process.myUserHandle().myUserId(); registerReceiver(); initCarrierAppList(); boolean islock = SystemProperties.getBoolean(DSDLOCKED_CARRIERID, false); if(!islock){ setPreInstallCarrierApkState(); //setPreInstallCarrierApkState(); } Log.d(TAG, "AppStateController init"); } private void initCarrierAppList() { for (String pkg : CARRIER_PREINSTALL_ARRAY) { AppState appState = new AppState(); appState.installState = false; appState.pkgName = pkg; mAppStateArrayList.add(appState); } } private void updateCarrierAppState() { CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); //PersistableBundle config = configManager.getConfig(); PersistableBundle config = configManager.getConfigLocked(); if (config != null) { Log.d(TAG, "config != null"); String[] preInstallApps = config.getStringArray(KEY_CARRIER_PREINSTALL); if (preInstallApps != null && preInstallApps.length > 0) { //dsd lock carrier_install is not null Log.d(TAG, "get carrier config preintall count = " + preInstallApps.length); for (String app : preInstallApps) { Log.d(TAG, "get carrier config preintall " + app); for (AppState appState : mAppStateArrayList) { if (appState.pkgName.equals(app)) { appState.installState = true; if (!mIsCarrierConfigLoaded) { Log.d(TAG, "mIsCarrierConfigLoaded = true"); mIsCarrierConfigLoaded = true; } } } } } else { //dsd lock carrier_install is null config = configManager.getConfig(); preInstallApps = config.getStringArray(KEY_CARRIER_PREINSTALL); if (preInstallApps != null && preInstallApps.length > 0) { //dsd lock carrier_install is not null Log.d(TAG, "else get carrier config preintall count = " + preInstallApps.length); if("com.gohappy.mobileapp".equals(preInstallApps[0])){ for (String app : preInstallApps) { Log.d(TAG, "else get carrier config preintall " + app); for (AppState appState : mAppStateArrayList) { if (appState.pkgName.equals(app)) { appState.installState = true; if (!mIsCarrierConfigLoaded) { Log.d(TAG, "mIsCarrierConfigLoaded = true"); mIsCarrierConfigLoaded = true; } } } } } } } } } private void registerReceiver() { IntentFilter mIntentFilter = new IntentFilter(); mIntentFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); //mIntentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); mIntentFilter.addAction(Intent.ACTION_LOCKED_BOOT_COMPLETED); mIntentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); mIntentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mIntentFilter.addAction(Intent.ACTION_USER_SWITCHED); mIntentFilter.addAction(Intent.ACTION_USER_REMOVED); mIntentFilter.addAction(Intent.ACTION_USER_ADDED); Loading @@ -149,8 +89,8 @@ public class AppStateController { Log.d(TAG,"ACTION_USER_SWITCHED userId = " + userId); Log.d(TAG,"ACTION_USER_SWITCHED getActiveLauncherPackageName = " + mPm.getActiveLauncherPackageName(userId)); if(mPm.getActiveLauncherPackageName(userId) == null || "com.google.android.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("com.android.launcher3",userId,successful -> { "org.lineageos.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading @@ -161,8 +101,8 @@ public class AppStateController { if (userId != mUserId) { Log.d(TAG, "ACTION_USER_SWITCHED" + " old user id = " + userId + " new user id = " + mUserId); mUserId = userId; updateCarrierAppState(); setPreInstallCarrierApkState(); //updateCarrierAppState(); //setPreInstallCarrierApkState(); } } Loading @@ -172,8 +112,8 @@ public class AppStateController { Log.d(TAG,"ACTION_USER_ADDED userId = " + userId); Log.d(TAG,"ACTION_USER_ADDED getActiveLauncherPackageName = " + mPm.getActiveLauncherPackageName(userId)); if(mPm.getActiveLauncherPackageName(userId) == null || "com.google.android.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("com.android.launcher3",userId,successful -> { "org.lineageos.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading @@ -187,8 +127,8 @@ public class AppStateController { if (userId != mUserId) { Log.d(TAG, "ACTION_USER_ADDED" + " old user id = " + userId + " new user id = " + mUserId); mUserId = userId; updateCarrierAppState(); setPreInstallCarrierApkState_forOtherUser(); //updateCarrierAppState(); //setPreInstallCarrierApkState_forOtherUser(); } } Loading @@ -213,8 +153,8 @@ public class AppStateController { if (uid != UserHandle.USER_SYSTEM){ mUserId = uid; Log.d(TAG, "disable preload app on user " + mUserId); updateCarrierAppState(); setPreInstallCarrierApkState_forOtherUser(); //updateCarrierAppState(); //setPreInstallCarrierApkState_forOtherUser(); mUserId = 0; } } Loading @@ -222,7 +162,7 @@ public class AppStateController { if (CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(intent.getAction())) { Log.d(TAG, "ACTION_CARRIER_CONFIG_CHANGED"); updateCarrierAppState(); //updateCarrierAppState(); mHandler.postDelayed(() -> judgeAndFireSetAppState(),200); } Loading @@ -247,7 +187,7 @@ public class AppStateController { Log.d(TAG, " judgeAndFireSetAppState mIsCarrierConfigLoaded " + mIsCarrierConfigLoaded + " mHasSetAppState = " + mHasSetAppState); return; } setPreInstallCarrierApkState(); //setPreInstallCarrierApkState(); mHasSetAppState = true; SystemProperties.set(DSDLOCKED_HASENABLEAPP, "1"); } Loading services/core/java/com/android/server/pm/PackageManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4210,7 +4210,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService for (int userId : UserManagerService.getInstance().getUserIds()) { if(getActiveLauncherPackageName(userId) == null){ setActiveLauncherPackage("com.android.launcher3",userId,successful -> { setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading Loading
services/core/java/com/android/server/pm/AppStateController.java +13 −73 Original line number Diff line number Diff line Loading @@ -65,79 +65,19 @@ public class AppStateController { mPm = pm; mUserId = Process.myUserHandle().myUserId(); registerReceiver(); initCarrierAppList(); boolean islock = SystemProperties.getBoolean(DSDLOCKED_CARRIERID, false); if(!islock){ setPreInstallCarrierApkState(); //setPreInstallCarrierApkState(); } Log.d(TAG, "AppStateController init"); } private void initCarrierAppList() { for (String pkg : CARRIER_PREINSTALL_ARRAY) { AppState appState = new AppState(); appState.installState = false; appState.pkgName = pkg; mAppStateArrayList.add(appState); } } private void updateCarrierAppState() { CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); //PersistableBundle config = configManager.getConfig(); PersistableBundle config = configManager.getConfigLocked(); if (config != null) { Log.d(TAG, "config != null"); String[] preInstallApps = config.getStringArray(KEY_CARRIER_PREINSTALL); if (preInstallApps != null && preInstallApps.length > 0) { //dsd lock carrier_install is not null Log.d(TAG, "get carrier config preintall count = " + preInstallApps.length); for (String app : preInstallApps) { Log.d(TAG, "get carrier config preintall " + app); for (AppState appState : mAppStateArrayList) { if (appState.pkgName.equals(app)) { appState.installState = true; if (!mIsCarrierConfigLoaded) { Log.d(TAG, "mIsCarrierConfigLoaded = true"); mIsCarrierConfigLoaded = true; } } } } } else { //dsd lock carrier_install is null config = configManager.getConfig(); preInstallApps = config.getStringArray(KEY_CARRIER_PREINSTALL); if (preInstallApps != null && preInstallApps.length > 0) { //dsd lock carrier_install is not null Log.d(TAG, "else get carrier config preintall count = " + preInstallApps.length); if("com.gohappy.mobileapp".equals(preInstallApps[0])){ for (String app : preInstallApps) { Log.d(TAG, "else get carrier config preintall " + app); for (AppState appState : mAppStateArrayList) { if (appState.pkgName.equals(app)) { appState.installState = true; if (!mIsCarrierConfigLoaded) { Log.d(TAG, "mIsCarrierConfigLoaded = true"); mIsCarrierConfigLoaded = true; } } } } } } } } } private void registerReceiver() { IntentFilter mIntentFilter = new IntentFilter(); mIntentFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); //mIntentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); mIntentFilter.addAction(Intent.ACTION_LOCKED_BOOT_COMPLETED); mIntentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); mIntentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED); mIntentFilter.addAction(Intent.ACTION_USER_SWITCHED); mIntentFilter.addAction(Intent.ACTION_USER_REMOVED); mIntentFilter.addAction(Intent.ACTION_USER_ADDED); Loading @@ -149,8 +89,8 @@ public class AppStateController { Log.d(TAG,"ACTION_USER_SWITCHED userId = " + userId); Log.d(TAG,"ACTION_USER_SWITCHED getActiveLauncherPackageName = " + mPm.getActiveLauncherPackageName(userId)); if(mPm.getActiveLauncherPackageName(userId) == null || "com.google.android.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("com.android.launcher3",userId,successful -> { "org.lineageos.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading @@ -161,8 +101,8 @@ public class AppStateController { if (userId != mUserId) { Log.d(TAG, "ACTION_USER_SWITCHED" + " old user id = " + userId + " new user id = " + mUserId); mUserId = userId; updateCarrierAppState(); setPreInstallCarrierApkState(); //updateCarrierAppState(); //setPreInstallCarrierApkState(); } } Loading @@ -172,8 +112,8 @@ public class AppStateController { Log.d(TAG,"ACTION_USER_ADDED userId = " + userId); Log.d(TAG,"ACTION_USER_ADDED getActiveLauncherPackageName = " + mPm.getActiveLauncherPackageName(userId)); if(mPm.getActiveLauncherPackageName(userId) == null || "com.google.android.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("com.android.launcher3",userId,successful -> { "org.lineageos.setupwizard".equals(mPm.getActiveLauncherPackageName(userId))){ mPm.setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading @@ -187,8 +127,8 @@ public class AppStateController { if (userId != mUserId) { Log.d(TAG, "ACTION_USER_ADDED" + " old user id = " + userId + " new user id = " + mUserId); mUserId = userId; updateCarrierAppState(); setPreInstallCarrierApkState_forOtherUser(); //updateCarrierAppState(); //setPreInstallCarrierApkState_forOtherUser(); } } Loading @@ -213,8 +153,8 @@ public class AppStateController { if (uid != UserHandle.USER_SYSTEM){ mUserId = uid; Log.d(TAG, "disable preload app on user " + mUserId); updateCarrierAppState(); setPreInstallCarrierApkState_forOtherUser(); //updateCarrierAppState(); //setPreInstallCarrierApkState_forOtherUser(); mUserId = 0; } } Loading @@ -222,7 +162,7 @@ public class AppStateController { if (CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(intent.getAction())) { Log.d(TAG, "ACTION_CARRIER_CONFIG_CHANGED"); updateCarrierAppState(); //updateCarrierAppState(); mHandler.postDelayed(() -> judgeAndFireSetAppState(),200); } Loading @@ -247,7 +187,7 @@ public class AppStateController { Log.d(TAG, " judgeAndFireSetAppState mIsCarrierConfigLoaded " + mIsCarrierConfigLoaded + " mHasSetAppState = " + mHasSetAppState); return; } setPreInstallCarrierApkState(); //setPreInstallCarrierApkState(); mHasSetAppState = true; SystemProperties.set(DSDLOCKED_HASENABLEAPP, "1"); } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -4210,7 +4210,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService for (int userId : UserManagerService.getInstance().getUserIds()) { if(getActiveLauncherPackageName(userId) == null){ setActiveLauncherPackage("com.android.launcher3",userId,successful -> { setActiveLauncherPackage("foundation.e.blisslauncher",userId,successful -> { if (successful) { Log.d(TAG,"default launcher set success for userId " + userId); }else{ Loading