Merge t-mpr-2023-08

Change-Id: I2804164cfa5e7c10256711ffdaadf3d2930823fd
This commit is contained in:
Matt Lee 2023-08-11 14:58:38 -07:00
commit 1711f06170
2 changed files with 12 additions and 1 deletions

View File

@ -44,7 +44,6 @@
<!-- for rotating surface by arbitrary degree -->
<uses-permission android:name="android.permission.ROTATE_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_HOME_APP_SEARCH_DATA" />
<!--
Permissions required for read/write access to the workspace data. These permission name

View File

@ -145,6 +145,18 @@ public class PackageManagerHelper {
* any permissions
*/
public boolean hasPermissionForActivity(Intent intent, String srcPackage) {
// b/270152142
if (Intent.ACTION_CHOOSER.equals(intent.getAction())) {
final Bundle extras = intent.getExtras();
if (extras == null) {
return true;
}
// If given intent is ACTION_CHOOSER, verify srcPackage has permission over EXTRA_INTENT
intent = (Intent) extras.getParcelable(Intent.EXTRA_INTENT);
if (intent == null) {
return true;
}
}
ResolveInfo target = mPm.resolveActivity(intent, 0);
if (target == null) {
// Not a valid target