summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin F. Haggerty <haggertk@lineageos.org>2019-10-15 00:05:10 (GMT)
committerKevin F. Haggerty <haggertk@lineageos.org>2019-10-15 00:05:10 (GMT)
commitab78fedc0100a93b5e9590b0fdc5cfa48386184e (patch)
tree2f0db493166875b09522ddafcc9e6e4a12d24cc3
parent9df23a34ac38d722401578c40dc0691899e763cd (diff)
parent06aed1054fbf7b3a434d93e153e6663e4fc3985c (diff)
downloadframeworks_base-ab78fedc0100a93b5e9590b0fdc5cfa48386184e.zip
frameworks_base-ab78fedc0100a93b5e9590b0fdc5cfa48386184e.tar.gz
frameworks_base-ab78fedc0100a93b5e9590b0fdc5cfa48386184e.tar.bz2
Merge tag 'android-9.0.0_r49' into staging/lineage-16.0_merge-android-9.0.0_r49
Android 9.0.0 Release 49 (5794013) * tag 'android-9.0.0_r49': (45 commits) [RESTRICT AUTOMERGE] Pass correct realCallingUid to startActivity() if provided by PendingIntentRecord#sendInner() OP_REQUEST_INSTALL_PACKAGES denied by default DO NOT MERGE Fix display freezing when screen size mismatches Fix Layout.primaryIsTrailingPreviousAllLineOffsets HidProfile: sync isPreferred() with HidHostService [RESTRICT AUTOMERGE] Correct argument order in permission check Clear the Parcel before writing an exception during a transaction [RESTRICT AUTOMERGE] Protect VPN dialogs against overlay. DO NOT MERGE SurfaceControl: Fix captureLayers JNI Clean up ProcessRecord when reuse a pid. Update API docs for TelecomManager#endCall. [RESTRICT AUTOMERGE] Fix NullPointerException when mLockPatternUtils is not set. [RESTRICT AUTOMERGE] Make LockTaskController default behaviour match ScreenPinningSettings. [RESTRICT AUTOMERGE] Careful with screenshots containing secure layers! Revert "[RESTRICT AUTOMERGE] Careful with screenshots containing secure layers!" [RESTRICT AUTOMERGE] Careful with screenshots containing secure layers! [RESTRICT AUTOMERGE]: Exclude secure layers from most screenshots taken by the system server. HwBlob: s/malloc/calloc/ SUPL ES Extension - June 2019 rollup Add cross user permission check - areNotificationsEnabledForPackage ... Change-Id: Ic06699506c8eabe8cc0cf339b9c04459771ff247
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java7
-rw-r--r--services/core/java/com/android/server/am/ActivityStartController.java28
-rw-r--r--services/core/java/com/android/server/am/ActivityStarter.java32
-rw-r--r--services/core/java/com/android/server/am/PendingIntentRecord.java4
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java6
5 files changed, 48 insertions, 29 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index da50d84..cc3e128 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5687,9 +5687,10 @@ public class ActivityManagerService extends IActivityManager.Stub
userId = mUserController.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
userId, false, ALLOW_FULL_ONLY, reason, null);
// TODO: Switch to user app stacks here.
- int ret = mActivityStartController.startActivities(caller, -1, callingPackage,
- intents, resolvedTypes, resultTo, SafeActivityOptions.fromBundle(bOptions), userId,
- reason, null /* originatingPendingIntent */);
+ int ret = mActivityStartController.startActivities(caller, -1, 0,
+ UserHandle.USER_NULL, callingPackage, intents, resolvedTypes, resultTo,
+ SafeActivityOptions.fromBundle(bOptions), userId, reason,
+ null /* originatingPendingIntent */);
return ret;
}
diff --git a/services/core/java/com/android/server/am/ActivityStartController.java b/services/core/java/com/android/server/am/ActivityStartController.java
index edcf6e7..c926503 100644
--- a/services/core/java/com/android/server/am/ActivityStartController.java
+++ b/services/core/java/com/android/server/am/ActivityStartController.java
@@ -286,20 +286,29 @@ public class ActivityStartController {
final int startActivitiesInPackage(int uid, String callingPackage, Intent[] intents,
String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId,
boolean validateIncomingUser, PendingIntentRecord originatingPendingIntent) {
+ return startActivitiesInPackage(uid, 0, UserHandle.USER_NULL,
+ callingPackage, intents, resolvedTypes, resultTo, options, userId,
+ validateIncomingUser, originatingPendingIntent);
+ }
+ final int startActivitiesInPackage(int uid, int realCallingPid, int realCallingUid,
+ String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo,
+ SafeActivityOptions options, int userId, boolean validateIncomingUser,
+ PendingIntentRecord originatingPendingIntent) {
final String reason = "startActivityInPackage";
userId = checkTargetUser(userId, validateIncomingUser, Binder.getCallingPid(),
Binder.getCallingUid(), reason);
// TODO: Switch to user app stacks here.
- return startActivities(null, uid, callingPackage, intents, resolvedTypes, resultTo, options,
- userId, reason, originatingPendingIntent);
+ return startActivities(null, uid, realCallingPid, realCallingUid, callingPackage, intents,
+ resolvedTypes, resultTo, options, userId, reason, originatingPendingIntent);
}
- int startActivities(IApplicationThread caller, int callingUid, String callingPackage,
- Intent[] intents, String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options,
- int userId, String reason, PendingIntentRecord originatingPendingIntent) {
+ int startActivities(IApplicationThread caller, int callingUid, int incomingRealCallingPid,
+ int incomingRealCallingUid, String callingPackage, Intent[] intents, String[] resolvedTypes,
+ IBinder resultTo, SafeActivityOptions options, int userId, String reason,
+ PendingIntentRecord originatingPendingIntent) {
if (intents == null) {
throw new NullPointerException("intents is null");
}
@@ -310,9 +319,12 @@ public class ActivityStartController {
throw new IllegalArgumentException("intents are length different than resolvedTypes");
}
- final int realCallingPid = Binder.getCallingPid();
- final int realCallingUid = Binder.getCallingUid();
-
+ final int realCallingPid = incomingRealCallingPid != 0
+ ? incomingRealCallingPid
+ : Binder.getCallingPid();
+ final int realCallingUid = incomingRealCallingUid != UserHandle.USER_NULL
+ ? incomingRealCallingUid
+ : Binder.getCallingUid();
int callingPid;
if (callingUid >= 0) {
callingPid = -1;
diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java
index a739af9..0be27d1 100644
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -282,6 +282,8 @@ class ActivityStarter {
* execution.
*/
private static class Request {
+ static final int DEFAULT_REAL_CALLING_PID = 0;
+ static final int DEFAULT_REAL_CALLING_UID = UserHandle.USER_NULL;
private static final int DEFAULT_CALLING_UID = -1;
private static final int DEFAULT_CALLING_PID = 0;
@@ -296,11 +298,11 @@ class ActivityStarter {
IBinder resultTo;
String resultWho;
int requestCode;
- int callingPid = DEFAULT_CALLING_UID;
- int callingUid = DEFAULT_CALLING_PID;
+ int callingPid = DEFAULT_CALLING_PID;
+ int callingUid = DEFAULT_CALLING_UID;
String callingPackage;
- int realCallingPid;
- int realCallingUid;
+ int realCallingPid = Request.DEFAULT_REAL_CALLING_PID;
+ int realCallingUid = Request.DEFAULT_REAL_CALLING_UID;
int startFlags;
SafeActivityOptions activityOptions;
boolean ignoreTargetSecurity;
@@ -354,8 +356,8 @@ class ActivityStarter {
callingPid = DEFAULT_CALLING_PID;
callingUid = DEFAULT_CALLING_UID;
callingPackage = null;
- realCallingPid = 0;
- realCallingUid = 0;
+ realCallingPid = Request.DEFAULT_REAL_CALLING_PID;
+ realCallingUid = Request.DEFAULT_REAL_CALLING_UID;
startFlags = 0;
activityOptions = null;
ignoreTargetSecurity = false;
@@ -370,7 +372,7 @@ class ActivityStarter {
mayWait = false;
avoidMoveToFront = false;
allowPendingRemoteAnimationRegistryLookup = true;
- filterCallingUid = UserHandle.USER_NULL;
+ filterCallingUid = DEFAULT_REAL_CALLING_UID;
originatingPendingIntent = null;
}
@@ -488,7 +490,8 @@ class ActivityStarter {
// for transactional diffs and preprocessing.
if (mRequest.mayWait) {
return startActivityMayWait(mRequest.caller, mRequest.callingUid,
- mRequest.callingPackage, mRequest.intent, mRequest.resolvedType,
+ mRequest.callingPackage, mRequest.realCallingPid, mRequest.realCallingUid,
+ mRequest.intent, mRequest.resolvedType,
mRequest.voiceSession, mRequest.voiceInteractor, mRequest.resultTo,
mRequest.resultWho, mRequest.requestCode, mRequest.startFlags,
mRequest.profilerInfo, mRequest.waitResult, mRequest.globalConfig,
@@ -999,7 +1002,8 @@ class ActivityStarter {
}
private int startActivityMayWait(IApplicationThread caller, int callingUid,
- String callingPackage, Intent intent, String resolvedType,
+ String callingPackage, int requestRealCallingPid, int requestRealCallingUid,
+ Intent intent, String resolvedType,
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
IBinder resultTo, String resultWho, int requestCode, int startFlags,
ProfilerInfo profilerInfo, WaitResult outResult,
@@ -1014,8 +1018,12 @@ class ActivityStarter {
mSupervisor.getActivityMetricsLogger().notifyActivityLaunching();
boolean componentSpecified = intent.getComponent() != null;
- final int realCallingPid = Binder.getCallingPid();
- final int realCallingUid = Binder.getCallingUid();
+ final int realCallingPid = requestRealCallingPid != Request.DEFAULT_REAL_CALLING_PID
+ ? requestRealCallingPid
+ : Binder.getCallingPid();
+ final int realCallingUid = requestRealCallingUid != Request.DEFAULT_REAL_CALLING_UID
+ ? requestRealCallingUid
+ : Binder.getCallingUid();
int callingPid;
if (callingUid >= 0) {
@@ -1242,7 +1250,7 @@ class ActivityStarter {
*/
static int computeResolveFilterUid(int customCallingUid, int actualCallingUid,
int filterCallingUid) {
- return filterCallingUid != UserHandle.USER_NULL
+ return filterCallingUid != Request.DEFAULT_REAL_CALLING_UID
? filterCallingUid
: (customCallingUid >= 0 ? customCallingUid : actualCallingUid);
}
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index 4e00304..81efbf3 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -344,8 +344,8 @@ final class PendingIntentRecord extends IIntentSender.Stub {
allResolvedTypes[allResolvedTypes.length-1] = resolvedType;
res = owner.getActivityStartController().startActivitiesInPackage(
- uid, key.packageName, allIntents, allResolvedTypes,
- resultTo, mergedOptions, userId,
+ uid, callingPid, callingUid, key.packageName, allIntents,
+ allResolvedTypes, resultTo, mergedOptions, userId,
false /* validateIncomingUser */,
this /* originatingPendingIntent */);
} else {
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index e500ad7..1e1942a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -24660,11 +24660,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
}
if (mExternalSourcesPolicy != null) {
int isTrusted = mExternalSourcesPolicy.getPackageTrustedToInstallApps(packageName, uid);
- if (isTrusted != PackageManagerInternal.ExternalSourcesPolicy.USER_DEFAULT) {
- return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED;
- }
+ return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED;
}
- return checkUidPermission(appOpPermission, uid) == PERMISSION_GRANTED;
+ return false;
}
@Override