Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e27ecb9 authored by tom hsu's avatar tom hsu
Browse files

[Panlingual] Fix icon shall have work badage in work profile.

Bug: 233064114
Test: local
Change-Id: I8aa24373f0381b172c30d16aedb2f9ba97238234
parent 97a3f548
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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();
    }

+8 −7
Original line number Diff line number Diff line
@@ -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();