Hide apks not needed for a specific sku

Test: Manual; Check if apks are installed/uninstalled.
Bug: 109675640
Change-Id: I20c27f25ae35cfa6f875930fed2b6805b1268fd7
This commit is contained in:
Ruchi Kandoi
2018-06-28 15:05:27 -07:00
parent f00bfbe46e
commit e350e7396f
3 changed files with 31 additions and 0 deletions

View File

@@ -3485,6 +3485,10 @@
<!-- Whether or not swipe up gesture's opt-in setting is available on this device -->
<bool name="config_swipe_up_gesture_setting_available">false</bool>
<!-- Applications which are disabled unless matching a particular sku -->
<string-array name="config_disableApksUnlessMatchedSku_apk_list" translatable="false" />
<string-array name="config_disableApkUnlessMatchedSku_skus_list" translatable="false" />
<!-- Whether or not we should show the option to show battery percentage -->
<bool name="config_battery_percentage_setting_available">true</bool>
</resources>

View File

@@ -3403,4 +3403,7 @@
<java-symbol type="integer" name="config_defaultHapticFeedbackIntensity" />
<java-symbol type="integer" name="config_defaultNotificationVibrationIntensity" />
<java-symbol type="array" name="config_disableApksUnlessMatchedSku_apk_list" />
<java-symbol type="array" name="config_disableApkUnlessMatchedSku_skus_list" />
</resources>

View File

@@ -21161,6 +21161,8 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(), this,
mContext.getContentResolver(), UserHandle.USER_SYSTEM);
disableSkuSpecificApps();
// Read the compatibilty setting when the system is ready.
boolean compatibilityModeEnabled = android.provider.Settings.Global.getInt(
mContext.getContentResolver(),
@@ -21948,6 +21950,28 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
}
}
//TODO: b/111402650
private void disableSkuSpecificApps() {
if (!mIsUpgrade && !mFirstBoot) {
return;
}
String apkList[] = mContext.getResources().getStringArray(
R.array.config_disableApksUnlessMatchedSku_apk_list);
String skuArray[] = mContext.getResources().getStringArray(
R.array.config_disableApkUnlessMatchedSku_skus_list);
if (ArrayUtils.isEmpty(apkList)) {
return;
}
String sku = SystemProperties.get("ro.boot.hardware.sku");
if (!TextUtils.isEmpty(sku) && ArrayUtils.contains(skuArray, sku)) {
return;
}
for (String packageName : apkList) {
setSystemAppHiddenUntilInstalled(packageName, true);
setSystemAppInstallState(packageName, false, ActivityManager.getCurrentUser());
}
}
private void dumpProto(FileDescriptor fd) {
final ProtoOutputStream proto = new ProtoOutputStream(fd);