Merge "Migrate to get{Int,String}ForUser" into stage-aosp-master am: b40240bd30

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19129306

Change-Id: I286fedd09aa39a96357407aec1d7ccc7f8362832
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Xin Li
2022-06-30 20:39:07 +00:00
committed by Automerger Merge Worker
4 changed files with 17 additions and 9 deletions

View File

@@ -8183,8 +8183,8 @@ public class ActivityManagerService extends IActivityManager.Stub
// do this when the system user is not setup since the setup wizard should be the one // do this when the system user is not setup since the setup wizard should be the one
// to handle home activity in this case. // to handle home activity in this case.
if (UserManager.isSplitSystemUser() && if (UserManager.isSplitSystemUser() &&
Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 0) != 0 Settings.Secure.USER_SETUP_COMPLETE, 0, currentUserId) != 0
|| SystemProperties.getBoolean(SYSTEM_USER_HOME_NEEDED, false)) { || SystemProperties.getBoolean(SYSTEM_USER_HOME_NEEDED, false)) {
t.traceBegin("enableHomeActivity"); t.traceBegin("enableHomeActivity");
ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class); ComponentName cName = new ComponentName(mContext, SystemUserHomeActivity.class);

View File

@@ -16,6 +16,7 @@
package com.android.server.am; package com.android.server.am;
import android.app.ActivityThread; import android.app.ActivityThread;
import android.content.ContentResolver;
import android.provider.Settings; import android.provider.Settings;
import android.util.ArrayMap; import android.util.ArrayMap;
@@ -53,9 +54,12 @@ public class ActivityManagerUtils {
static int getAndroidIdHash() { static int getAndroidIdHash() {
// No synchronization is required. Double-initialization is fine here. // No synchronization is required. Double-initialization is fine here.
if (sAndroidIdHash == null) { if (sAndroidIdHash == null) {
final String androidId = Settings.Secure.getString( final ContentResolver resolver = ActivityThread.currentApplication()
ActivityThread.currentApplication().getContentResolver(), .getContentResolver();
Settings.Secure.ANDROID_ID); final String androidId = Settings.Secure.getStringForUser(
resolver,
Settings.Secure.ANDROID_ID,
resolver.getUserId());
sAndroidIdHash = getUnsignedHashUnCached( sAndroidIdHash = getUnsignedHashUnCached(
sInjectedAndroidId != null ? sInjectedAndroidId : androidId); sInjectedAndroidId != null ? sInjectedAndroidId : androidId);
} }

View File

@@ -28,6 +28,7 @@ import android.app.AnrController;
import android.app.ApplicationErrorReport; import android.app.ApplicationErrorReport;
import android.app.ApplicationExitInfo; import android.app.ApplicationExitInfo;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.IncrementalStatesInfo; import android.content.pm.IncrementalStatesInfo;
@@ -626,8 +627,11 @@ class ProcessErrorStateRecord {
} }
private boolean getShowBackground() { private boolean getShowBackground() {
return Settings.Secure.getInt(mService.mContext.getContentResolver(), final ContentResolver resolver = mService.mContext.getContentResolver();
Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0; return Settings.Secure.getIntForUser(resolver,
Settings.Secure.ANR_SHOW_BACKGROUND,
0,
resolver.getUserId()) != 0;
} }
/** /**

View File

@@ -218,8 +218,8 @@ public class ActivityStartController {
vers = ri.activityInfo.applicationInfo.metaData.getString( vers = ri.activityInfo.applicationInfo.metaData.getString(
Intent.METADATA_SETUP_VERSION); Intent.METADATA_SETUP_VERSION);
} }
String lastVers = Settings.Secure.getString( String lastVers = Settings.Secure.getStringForUser(
resolver, Settings.Secure.LAST_SETUP_SHOWN); resolver, Settings.Secure.LAST_SETUP_SHOWN, resolver.getUserId());
if (vers != null && !vers.equals(lastVers)) { if (vers != null && !vers.equals(lastVers)) {
intent.setFlags(FLAG_ACTIVITY_NEW_TASK); intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(new ComponentName( intent.setComponent(new ComponentName(