From f857fd435770d6c7b4e6d18c4b05da92fce76ab8 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Thu, 15 Sep 2022 14:21:58 +0000 Subject: [PATCH 1/3] For top layout use FrameLayout than GlifLayout In these xml files we are having nested GlifLayout, that I think messes up the UI Bug: 237169259 Test: Manual Change-Id: I9df8b1b7b5c19c61b92b30432bc7d78325876425 (cherry picked from commit 3dcf68f321f4111c69f21853c7aa49b53d48bcb0) Merged-In: I9df8b1b7b5c19c61b92b30432bc7d78325876425 --- res/layout-sw600dp/confirm_lock_password.xml | 8 +++----- res/layout-sw600dp/confirm_lock_pattern.xml | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/res/layout-sw600dp/confirm_lock_password.xml b/res/layout-sw600dp/confirm_lock_password.xml index 3925a698417..7489d100564 100644 --- a/res/layout-sw600dp/confirm_lock_password.xml +++ b/res/layout-sw600dp/confirm_lock_password.xml @@ -14,16 +14,14 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> - + android:layout_height="match_parent"> - + diff --git a/res/layout-sw600dp/confirm_lock_pattern.xml b/res/layout-sw600dp/confirm_lock_pattern.xml index 51af1f3d3d0..1551517d021 100644 --- a/res/layout-sw600dp/confirm_lock_pattern.xml +++ b/res/layout-sw600dp/confirm_lock_pattern.xml @@ -13,16 +13,14 @@ See the License for the specific language governing permissions and limitations under the License. --> - + android:layout_height="match_parent"> - + From 436ede94c394832b6bd8ffe1bcb44b18dccb1c7e Mon Sep 17 00:00:00 2001 From: Mariia Sandrikova Date: Sun, 22 Jan 2023 17:02:10 +0000 Subject: [PATCH 2/3] Remove "nosensor" restriction from FallbackHome This was previously added in I875fa6d112db23273026dbc39b5d32748d7e99f1 to match boot animation orientation. But the first system orientation after boot is no longer influenced by FallbackHome and instead is influenced by the default rotation in DisplayRotation#readDefaultDisplayRotation so it should be safe to remove this restriction. On the other side, if we keep this restriction it can lead to orientation flickering on devices that have ignoreOrientationRequest enabled since "nosensor" is respected on them unlike other orientations so it's possible that FallbackHome and launcher orientations won't match. Fix: 264329911 Test: manual Change-Id: I688a4ba3d81c1fe908b9f88c3d601aaccc4f2119 --- AndroidManifest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6d2c636ccf7..bea9a3c7aa1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2973,7 +2973,6 @@ Date: Mon, 23 Jan 2023 15:00:42 +0100 Subject: [PATCH 3/3] Enforce INTERACT_ACROSS_USERS_FULL permission for NotificationAccessDetails When using EXTRA_USER_HANDLE, check for INTERACT_ACROSS_USERS_FULL permission on calling package. Bug: 259385017 Test: 1. Build a test app that creates and starts an intent to NOTIFICATION_LISTENER_DETAIL_SETTINGS while setting the intent extra "android.intent.extra.user_handle" to UserHandle(secondaryUserId). 2. Create and switch to a secondary user Settings > System > Multiple users > Allow multiple users > Add user > Switch to New user 3. Open Settings > Notifications > Device & app notifications and choose an app from the list (uses android.permission.BIND_NOTIFICATION_LISTENER_SERVICE). Enable Device & app notifications for selected app and disable all attributed permissions. 4. Switch back to the Owner user. 5. Get the userId of the secondary user: adb shell pm list users. 6. Open the test app and enter the userId for the secondary user and the component name that uses android.permission.BIND_NOTIFICATION_LISTENER_SERVICE. 8. In the settings window that open, enable all 4 sub-options. 9. Switch to the secondary user and note that the all sub-options for the app are disabled. Change-Id: I875b9f2fc32c252acdcf8374a14067836e0f1ac6 --- .../NotificationAccessDetails.java | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java b/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java index e6feebb92ab..2094890d4f0 100644 --- a/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java +++ b/src/com/android/settings/applications/specialaccess/notificationaccess/NotificationAccessDetails.java @@ -16,14 +16,14 @@ package com.android.settings.applications.specialaccess.notificationaccess; +import static android.content.pm.PackageManager.PERMISSION_GRANTED; + import static com.android.settings.applications.AppInfoBase.ARG_PACKAGE_NAME; -import android.app.Activity; +import android.Manifest; import android.app.NotificationManager; import android.app.settings.SettingsEnums; import android.companion.ICompanionDeviceManager; -import android.compat.annotation.ChangeId; -import android.compat.annotation.EnabledAfter; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -37,8 +37,8 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; -import android.service.notification.NotificationListenerFilter; import android.service.notification.NotificationListenerService; +import android.text.TextUtils; import android.util.Log; import android.util.Slog; @@ -48,7 +48,6 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.applications.AppInfoBase; -import com.android.settings.applications.manageapplications.ManageApplications; import com.android.settings.bluetooth.Utils; import com.android.settings.core.SubSettingLauncher; import com.android.settings.dashboard.DashboardFragment; @@ -208,8 +207,12 @@ public class NotificationAccessDetails extends DashboardFragment { } } if (intent != null && intent.hasExtra(Intent.EXTRA_USER_HANDLE)) { - mUserId = ((UserHandle) intent.getParcelableExtra( - Intent.EXTRA_USER_HANDLE)).getIdentifier(); + if (hasInteractAcrossUsersPermission()) { + mUserId = ((UserHandle) intent.getParcelableExtra( + Intent.EXTRA_USER_HANDLE)).getIdentifier(); + } else { + finish(); + } } else { mUserId = UserHandle.myUserId(); } @@ -224,6 +227,26 @@ public class NotificationAccessDetails extends DashboardFragment { } } + private boolean hasInteractAcrossUsersPermission() { + final String callingPackageName = + ((SettingsActivity) getActivity()).getInitialCallingPackage(); + + if (TextUtils.isEmpty(callingPackageName)) { + Log.w(TAG, "Not able to get calling package name for permission check"); + return false; + } + + if (getContext().getPackageManager().checkPermission( + Manifest.permission.INTERACT_ACROSS_USERS_FULL, callingPackageName) + != PERMISSION_GRANTED) { + Log.w(TAG, "Package " + callingPackageName + " does not have required permission " + + Manifest.permission.INTERACT_ACROSS_USERS_FULL); + return false; + } + + return true; + } + // Dialogs only have access to the parent fragment, not the controller, so pass the information // along to keep business logic out of this file public void disable(final ComponentName cn) {