Merge "[Panlingual] Fix icon shall have work badage in work profile." into tm-dev am: 883f5e2572 am: 89f6686597

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18491260

Change-Id: I00b96bc50b83e401829e2db02dd9ab6a1c0c017c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tom Hsu
2022-05-23 16:58:30 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 10 deletions

View File

@@ -66,11 +66,13 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
/**
* Create a instance of AppLocaleDetails.
* @param packageName Indicates which application need to show the locale picker.
* @param uid User id.
*/
public static AppLocaleDetails newInstance(String packageName) {
public static AppLocaleDetails newInstance(String packageName, int uid) {
AppLocaleDetails appLocaleDetails = new AppLocaleDetails();
Bundle bundle = new Bundle();
bundle.putString(AppInfoBase.ARG_PACKAGE_NAME, packageName);
bundle.putInt(AppInfoBase.ARG_PACKAGE_UID, uid);
appLocaleDetails.setArguments(bundle);
return appLocaleDetails;
}
@@ -81,13 +83,15 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
Bundle bundle = getArguments();
mPackageName = bundle.getString(AppInfoBase.ARG_PACKAGE_NAME, "");
if (mPackageName.isEmpty()) {
Log.d(TAG, "No package name.");
Log.d(TAG, "There is no package name.");
finish();
}
int uid = bundle.getInt(AppInfoBase.ARG_PACKAGE_UID, getContext().getUserId());
addPreferencesFromResource(R.xml.app_locale_details);
mPrefOfDescription = getPreferenceScreen().findPreference(KEY_APP_DESCRIPTION);
mPrefOfDisclaimer = getPreferenceScreen().findPreference(KEY_APP_DISCLAIMER);
mApplicationInfo = getApplicationInfo(mPackageName, getContext().getUserId());
mApplicationInfo = getApplicationInfo(mPackageName, uid);
setDisclaimerPreference();
}

View File

@@ -62,13 +62,14 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
finish();
return;
}
int uid = getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
if (uid == -1) {
Log.w(TAG, "Unexpected user id");
finish();
}
UserHandle userHandle = UserHandle.getUserHandleForUid(uid);
mContextAsUser = this;
if (getIntent().hasExtra(AppInfoBase.ARG_PACKAGE_UID)) {
int userId = getIntent().getIntExtra(AppInfoBase.ARG_PACKAGE_UID, -1);
if (userId != -1) {
UserHandle userHandle = UserHandle.getUserHandleForUid(userId);
mContextAsUser = createContextAsUser(userHandle, 0);
}
}
setTitle(R.string.app_locale_picker_title);
getActionBar().setDisplayHomeAsUpEnabled(true);
@@ -79,7 +80,7 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
false /* translate only */,
mPackageName,
this);
mAppLocaleDetails = AppLocaleDetails.newInstance(mPackageName);
mAppLocaleDetails = AppLocaleDetails.newInstance(mPackageName, mContextAsUser.getUserId());
mAppLocaleDetailContainer = launchAppLocaleDetailsPage();
// Launch Locale picker part.
launchLocalePickerPage();