commit | 787f1f5c2e133dc6a64d91015802ce0d6b4e7ca2 | [log] [tgz] |
---|---|---|
author | Chris Antol <cantol@google.com> | Mon Mar 25 23:49:35 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Jul 10 22:17:36 2024 +0000 |
tree | 2b84422a4af2b6faf820e3b2d66db730b1807cbf | |
parent | 834bc38427021adec27a3abb040426080f1796ec [diff] |
RESTRICT AUTOMERGE Restrict Settings Homepage prior to provisioning Bug: 327749022 Test: manual test 1. factory reset + launch Settings via ADB during Setup -> verify app closes 2. factory reset + bypass Setup + tap Settings icon in launcher -> verify app closes (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:70a5a0fd353cc6203d2926627de93786155ae5bc) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:477d4a8d6ba390ed0f9b150ca271966cd967820a) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d83f47397e61d5ec04866af20efcb935a58cbdff) Merged-In: I8cbe38109ebf88a0f68f3917e95468a81c6463c1 Change-Id: I8cbe38109ebf88a0f68f3917e95468a81c6463c1
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index b3f84d6..3d00613 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -174,6 +174,16 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Ensure device is provisioned in order to access Settings home + // TODO(b/331254029): This should later be replaced in favor of an allowlist + boolean unprovisioned = android.provider.Settings.Global.getInt(getContentResolver(), + android.provider.Settings.Global.DEVICE_PROVISIONED, 0) == 0; + if (unprovisioned) { + Log.e(TAG, "Device is not provisioned, exiting Settings"); + finish(); + return; + } + mIsEmbeddingActivityEnabled = ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this); if (mIsEmbeddingActivityEnabled) { final UserManager um = getSystemService(UserManager.class);