From d735f9a1a88d8efecb7e55a3fed320f3220973a3 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Mon, 19 Dec 2022 16:09:19 +0800 Subject: [PATCH 1/7] Set setModeByUid to align with current behavior For the following App Lists, - All Files Access - Media Management Apps Default false, if true, use AppOpsManager#setUidMode instead of #setMode This follows Change: I261953ff88bc049cf0a2f04f8caac00b8cc6f704 Reason: Security related app-ops should be set with AppOpsManager#setUidMode instead of AppOpsManager#setMode. Bug: 235727273 Test: Unit test Change-Id: I953b63c2bf6f3bd94aacc935c8c3579bc8aed199 --- .../spa/app/specialaccess/AllFilesAccess.kt | 1 + .../app/specialaccess/MediaManagementApps.kt | 1 + .../app/specialaccess/AllFilesAccessTest.kt | 65 +++++++++++++++++++ .../specialaccess/MediaManagementAppsTest.kt | 65 +++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 tests/spa_unit/src/com/android/settings/spa/app/specialaccess/AllFilesAccessTest.kt create mode 100644 tests/spa_unit/src/com/android/settings/spa/app/specialaccess/MediaManagementAppsTest.kt diff --git a/src/com/android/settings/spa/app/specialaccess/AllFilesAccess.kt b/src/com/android/settings/spa/app/specialaccess/AllFilesAccess.kt index 5efe3227191..6466e038006 100644 --- a/src/com/android/settings/spa/app/specialaccess/AllFilesAccess.kt +++ b/src/com/android/settings/spa/app/specialaccess/AllFilesAccess.kt @@ -34,4 +34,5 @@ class AllFilesAccessListModel(context: Context) : AppOpPermissionListModel(conte override val footerResId = R.string.allow_manage_external_storage_description override val appOp = AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE override val permission = Manifest.permission.MANAGE_EXTERNAL_STORAGE + override val setModeByUid = true } diff --git a/src/com/android/settings/spa/app/specialaccess/MediaManagementApps.kt b/src/com/android/settings/spa/app/specialaccess/MediaManagementApps.kt index 92e369dd065..6c7678a0629 100644 --- a/src/com/android/settings/spa/app/specialaccess/MediaManagementApps.kt +++ b/src/com/android/settings/spa/app/specialaccess/MediaManagementApps.kt @@ -34,4 +34,5 @@ class MediaManagementAppsListModel(context: Context) : AppOpPermissionListModel( override val footerResId = R.string.media_management_apps_description override val appOp = AppOpsManager.OP_MANAGE_MEDIA override val permission = Manifest.permission.MANAGE_MEDIA + override val setModeByUid = true } \ No newline at end of file diff --git a/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/AllFilesAccessTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/AllFilesAccessTest.kt new file mode 100644 index 00000000000..f5d422dcb94 --- /dev/null +++ b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/AllFilesAccessTest.kt @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.spa.app.specialaccess + +import android.Manifest +import android.app.AppOpsManager +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.android.settings.R +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class AllFilesAccessTest { + private val context: Context = ApplicationProvider.getApplicationContext() + + private val listModel = AllFilesAccessListModel(context) + + @Test + fun pageTitleResId() { + assertThat(listModel.pageTitleResId).isEqualTo(R.string.manage_external_storage_title) + } + + @Test + fun switchTitleResId() { + assertThat(listModel.switchTitleResId).isEqualTo(R.string.permit_manage_external_storage) + } + + @Test + fun footerResId() { + assertThat(listModel.footerResId) + .isEqualTo(R.string.allow_manage_external_storage_description) + } + + @Test + fun appOp() { + assertThat(listModel.appOp).isEqualTo(AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE) + } + + @Test + fun permission() { + assertThat(listModel.permission).isEqualTo(Manifest.permission.MANAGE_EXTERNAL_STORAGE) + } + + @Test + fun setModeByUid() { + assertThat(listModel.setModeByUid).isTrue() + } +} \ No newline at end of file diff --git a/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/MediaManagementAppsTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/MediaManagementAppsTest.kt new file mode 100644 index 00000000000..b56d9974d66 --- /dev/null +++ b/tests/spa_unit/src/com/android/settings/spa/app/specialaccess/MediaManagementAppsTest.kt @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.spa.app.specialaccess + +import android.Manifest +import android.app.AppOpsManager +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.android.settings.R +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class MediaManagementAppsTest { + private val context: Context = ApplicationProvider.getApplicationContext() + + private val listModel = MediaManagementAppsListModel(context) + + @Test + fun pageTitleResId() { + assertThat(listModel.pageTitleResId).isEqualTo(R.string.media_management_apps_title) + } + + @Test + fun switchTitleResId() { + assertThat(listModel.switchTitleResId) + .isEqualTo(R.string.media_management_apps_toggle_label) + } + + @Test + fun footerResId() { + assertThat(listModel.footerResId).isEqualTo(R.string.media_management_apps_description) + } + + @Test + fun appOp() { + assertThat(listModel.appOp).isEqualTo(AppOpsManager.OP_MANAGE_MEDIA) + } + + @Test + fun permission() { + assertThat(listModel.permission).isEqualTo(Manifest.permission.MANAGE_MEDIA) + } + + @Test + fun setModeByUid() { + assertThat(listModel.setModeByUid).isTrue() + } +} \ No newline at end of file From aa3ec01f9f0a9b50dd49c67d78fcc8fd0777dd89 Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Wed, 21 Dec 2022 00:32:21 +0000 Subject: [PATCH 2/7] Change keyboard layout parameters to include Layout type. Test: atest KeyboardLayoutPickerControllerTest Bug: 259530132 Change-Id: I112d2c25ca5eeacee445e247bf40a57d358e7f42 --- .../inputmethod/KeyboardLayoutPickerControllerTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java index a26ef8c6c34..52d10833ef8 100644 --- a/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java +++ b/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java @@ -174,7 +174,7 @@ public class KeyboardLayoutPickerControllerTest { } private void initializeOneLayout() { - final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 1, 1)}; + final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 0, 1, 1)}; when(mInputManager.getKeyboardLayoutsForInputDevice( any(InputDeviceIdentifier.class))).thenReturn( keyboardLayouts); @@ -183,8 +183,8 @@ public class KeyboardLayoutPickerControllerTest { } private void initializeTwoLayouts() { - final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 1, 1), - new KeyboardLayout("", "", "", 2, null, 2, 2)}; + final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 0, 1, 1), + new KeyboardLayout("", "", "", 2, null, 0, 2, 2)}; when(mInputManager.getKeyboardLayoutsForInputDevice(any(InputDeviceIdentifier.class))). thenReturn(keyboardLayouts); From beab3c0d43a7b5f7f54d823457c7959747d03026 Mon Sep 17 00:00:00 2001 From: sandeepjs Date: Wed, 21 Dec 2022 12:01:01 +0000 Subject: [PATCH 3/7] [Android U][eSIM] Modify esim and sim card strings as part of esim primary As part of esim primary, esim and sim card related strings are changed for AndroidSettings project with reference from https://docs.google.com/spreadsheets/d/1RPVnNvmcjd-NSvPGg1jOi0mdC-sbCHvt9HVU4glV8fs/edit#gid=1716745126 Test: build Bug: 257380320 Change-Id: If2183945054255d52e89a61a04db25edd725a73d --- res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 1f81129dbe3..249c2de990d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10470,7 +10470,7 @@ Confirm SIM deletion - Verify it\u0027s you before erasing a eSIM + Verify it\u0027s you before erasing an eSIM This work profile is managed by: From 494f76d115fa4e058241630a35500c201a330b64 Mon Sep 17 00:00:00 2001 From: Peter Liang Date: Wed, 21 Dec 2022 21:21:13 +0800 Subject: [PATCH 4/7] Fix when adjusting the display size, the font size flashes. Action: By super to access the parent function to save the highlighted state of the preference. Bug: 250800752 Test: manual test Change-Id: Idca9a4f31910638c19f26ff01136530d17677055 --- .../settings/accessibility/TextReadingPreferenceFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java index 22bef288282..7316e12641d 100644 --- a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java +++ b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java @@ -210,6 +210,8 @@ public class TextReadingPreferenceFragment extends DashboardFragment { @Override public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + if (mNeedResetSettings) { outState.putBoolean(NEED_RESET_SETTINGS, true); } From 85e0deb14d9a78d71132ac1f43ce03b5fc3f35e6 Mon Sep 17 00:00:00 2001 From: danielwbhuang Date: Wed, 26 Oct 2022 20:40:32 +0800 Subject: [PATCH 5/7] Implement modifier keys settings UI. Add four modifier keys and one reset button. Bug: 244535460 Test: local test Change-Id: I45822b0d8391022c17439dc25ab86fe022e9f43f --- res/drawable/ic_modifier_keys_reset.xml | 28 +++ res/drawable/modifier_key_bordered.xml | 32 +++ res/drawable/modifier_key_colored.xml | 29 +++ .../modifier_key_lisetview_background.xml | 29 +++ res/layout/modifier_key_item.xml | 49 +++++ res/layout/modifier_key_picker_dialog.xml | 107 ++++++++++ res/layout/modifier_key_reset_dialog.xml | 86 ++++++++ res/values/strings.xml | 31 +++ res/values/styles.xml | 14 ++ res/xml/modifier_keys_settings.xml | 48 +++++ res/xml/physical_keyboard_settings.xml | 6 + .../core/gateway/SettingsGateway.java | 2 + .../ModifierKeysPickerDialogFragment.java | 198 ++++++++++++++++++ .../ModifierKeysPreferenceController.java | 88 ++++++++ .../ModifierKeysResetDialogFragment.java | 104 +++++++++ ...difierKeysRestorePreferenceController.java | 107 ++++++++++ .../inputmethod/ModifierKeysSettings.java | 64 ++++++ .../inputmethod/PhysicalKeyboardFragment.java | 8 +- 18 files changed, 1029 insertions(+), 1 deletion(-) create mode 100644 res/drawable/ic_modifier_keys_reset.xml create mode 100644 res/drawable/modifier_key_bordered.xml create mode 100644 res/drawable/modifier_key_colored.xml create mode 100644 res/drawable/modifier_key_lisetview_background.xml create mode 100644 res/layout/modifier_key_item.xml create mode 100644 res/layout/modifier_key_picker_dialog.xml create mode 100644 res/layout/modifier_key_reset_dialog.xml create mode 100644 res/xml/modifier_keys_settings.xml create mode 100644 src/com/android/settings/inputmethod/ModifierKeysPickerDialogFragment.java create mode 100644 src/com/android/settings/inputmethod/ModifierKeysPreferenceController.java create mode 100644 src/com/android/settings/inputmethod/ModifierKeysResetDialogFragment.java create mode 100644 src/com/android/settings/inputmethod/ModifierKeysRestorePreferenceController.java create mode 100644 src/com/android/settings/inputmethod/ModifierKeysSettings.java diff --git a/res/drawable/ic_modifier_keys_reset.xml b/res/drawable/ic_modifier_keys_reset.xml new file mode 100644 index 00000000000..a8cc1984c94 --- /dev/null +++ b/res/drawable/ic_modifier_keys_reset.xml @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file diff --git a/res/drawable/modifier_key_bordered.xml b/res/drawable/modifier_key_bordered.xml new file mode 100644 index 00000000000..17f0090a678 --- /dev/null +++ b/res/drawable/modifier_key_bordered.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/modifier_key_colored.xml b/res/drawable/modifier_key_colored.xml new file mode 100644 index 00000000000..2bb033b5def --- /dev/null +++ b/res/drawable/modifier_key_colored.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/modifier_key_lisetview_background.xml b/res/drawable/modifier_key_lisetview_background.xml new file mode 100644 index 00000000000..b65c61ee122 --- /dev/null +++ b/res/drawable/modifier_key_lisetview_background.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/modifier_key_item.xml b/res/layout/modifier_key_item.xml new file mode 100644 index 00000000000..7bd344c8bb2 --- /dev/null +++ b/res/layout/modifier_key_item.xml @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git a/res/layout/modifier_key_picker_dialog.xml b/res/layout/modifier_key_picker_dialog.xml new file mode 100644 index 00000000000..86003480ecd --- /dev/null +++ b/res/layout/modifier_key_picker_dialog.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + +