[Panlingual] Fix the app language is shown incorrectly in the work profile

The root cause is that the context corresponding to the specified
profile Id is not correctly used when using LocaleManager to query the
app language.

Bug: 222769707
Test: Verify the issue by using the steps provided in the bug
Change-Id: Ic1f9e4cc9e90f5aecfa5e1094184aa63f3d94ffb
This commit is contained in:
Josh Hou
2022-03-28 11:53:19 +08:00
parent 213b3ce4af
commit e32d422d3d
4 changed files with 27 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.applications.AppLocaleUtil;
import com.android.settings.localepicker.AppLocalePickerActivity;
@@ -62,7 +63,7 @@ public class AppLocalePreferenceController extends AppInfoPreferenceControllerBa
@Override
public CharSequence getSummary() {
return AppLocaleDetails.getSummary(mContext, mParent.getAppEntry().info.packageName);
return AppLocaleDetails.getSummary(mContext, mParent.getAppEntry());
}
@Override
@@ -74,6 +75,7 @@ public class AppLocalePreferenceController extends AppInfoPreferenceControllerBa
if (mParent != null) {
Intent intent = new Intent(mContext, AppLocalePickerActivity.class);
intent.setData(Uri.parse("package:" + mParent.getAppEntry().info.packageName));
intent.putExtra(AppInfoBase.ARG_PACKAGE_UID, mParent.getAppEntry().info.uid);
mContext.startActivity(intent);
return true;
} else {