[policy] system_server should not call non forUser Settings.Secure.get* methods

BUG: 166312046
Test: builds
Change-Id: Icdbe405bb9e50ab2e44e3755f5a2e69e632c4f0e
This commit is contained in:
Songchun Fan
2020-09-03 15:34:30 -07:00
parent 4743509c7e
commit e447e11083

View File

@@ -31,6 +31,7 @@ import android.annotation.UserIdInt;
import android.app.AppOpsManager;
import android.app.AppOpsManagerInternal;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -242,8 +243,9 @@ public final class PermissionPolicyService extends SystemService {
public void onReceive(Context context, Intent intent) {
boolean hasSetupRun = true;
try {
hasSetupRun = Settings.Secure.getInt(getContext().getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE) != 0;
final ContentResolver cr = getContext().getContentResolver();
hasSetupRun = Settings.Secure.getIntForUser(cr,
Settings.Secure.USER_SETUP_COMPLETE, cr.getUserId()) != 0;
} catch (Settings.SettingNotFoundException e) {
// Ignore error, assume setup has run
}