Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Revisiona3a788cac4b38d0d2fd44839cc4872fe21492dc1 (tree)
Time2019-10-24 13:31:17
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Android 8.1.0 Release 69 (5794017)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCXZfQawAKCRDorT+BmrEO
eMgmAJ4ohvWQsPOsprjnvx7sw/pfaibdLgCeIRB1ELtew1xFMCNmxGQRtNV5fLI=
=ckiK
-----END PGP SIGNATURE-----

Merge tag 'android-8.1.0_r69' into oreo-x86

Android 8.1.0 Release 69 (5794017)

Change Summary

Incremental Difference

--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -706,6 +706,8 @@ public class Binder implements IBinder {
706706 Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e);
707707 }
708708 } else {
709+ // Clear the parcel before writing the exception
710+ reply.setDataSize(0);
709711 reply.setDataPosition(0);
710712 reply.writeException(e);
711713 }
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1070,6 +1070,9 @@ public abstract class Layout {
10701070 if (limit > lineEnd) {
10711071 limit = lineEnd;
10721072 }
1073+ if (limit == start) {
1074+ continue;
1075+ }
10731076 level[limit - lineStart - 1] =
10741077 (byte) ((runs[i + 1] >>> RUN_LEVEL_SHIFT) & RUN_LEVEL_MASK);
10751078 }
@@ -1165,8 +1168,8 @@ public abstract class Layout {
11651168 }
11661169
11671170 /**
1168- * Computes in linear time the results of calling
1169- * #getHorizontal for all offsets on a line.
1171+ * Computes in linear time the results of calling #getHorizontal for all offsets on a line.
1172+ *
11701173 * @param line The line giving the offsets we compute information for
11711174 * @param clamped Whether to clamp the results to the width of the layout
11721175 * @param primary Whether the results should be the primary or the secondary horizontal
@@ -1201,7 +1204,7 @@ public abstract class Layout {
12011204 TextLine.recycle(tl);
12021205
12031206 if (clamped) {
1204- for (int offset = 0; offset <= wid.length; ++offset) {
1207+ for (int offset = 0; offset < wid.length; ++offset) {
12051208 if (wid[offset] > mWidth) {
12061209 wid[offset] = mWidth;
12071210 }
--- a/core/jni/android_os_HwBlob.cpp
+++ b/core/jni/android_os_HwBlob.cpp
@@ -84,7 +84,7 @@ JHwBlob::JHwBlob(JNIEnv *env, jobject thiz, size_t size)
8484 mOwnsBuffer(true),
8585 mHandle(0) {
8686 if (size > 0) {
87- mBuffer = malloc(size);
87+ mBuffer = calloc(size, 1);
8888 }
8989 }
9090
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java
@@ -121,7 +121,7 @@ public class HidProfile implements LocalBluetoothProfile {
121121
122122 public boolean isPreferred(BluetoothDevice device) {
123123 if (mService == null) return false;
124- return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF;
124+ return mService.getPriority(device) != BluetoothProfile.PRIORITY_OFF;
125125 }
126126
127127 public int getPreferred(BluetoothDevice device) {
--- a/packages/VpnDialogs/AndroidManifest.xml
+++ b/packages/VpnDialogs/AndroidManifest.xml
@@ -21,6 +21,7 @@
2121
2222 <uses-permission android:name="android.permission.CONTROL_VPN" />
2323 <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
24+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS"/>
2425
2526 <application android:label="VpnDialogs"
2627 android:allowBackup="false" >
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
@@ -16,6 +16,8 @@
1616
1717 package com.android.vpndialogs;
1818
19+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
20+
1921 import android.content.Context;
2022 import android.content.DialogInterface;
2123 import android.content.pm.PackageManager;
@@ -78,6 +80,7 @@ public class ConfirmDialog extends AlertActivity
7880 setupAlert();
7981
8082 getWindow().setCloseOnTouchOutside(false);
83+ getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
8184 Button button = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
8285 button.setFilterTouchesWhenObscured(true);
8386 }
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -4925,9 +4925,9 @@ public class ActivityManagerService extends IActivityManager.Stub
49254925 userId, false, ALLOW_FULL_ONLY, "startActivityInPackage", null);
49264926
49274927 // TODO: Switch to user app stacks here.
4928- return mActivityStarter.startActivityMayWait(null, uid, callingPackage, intent,
4929- resolvedType, null, null, resultTo, resultWho, requestCode, startFlags,
4930- null, null, null, bOptions, false, userId, inTask, reason);
4928+ return mActivityStarter.startActivityMayWait(null, uid, ActivityStarter.PID_NULL, uid,
4929+ callingPackage, intent, resolvedType, null, null, resultTo, resultWho, requestCode,
4930+ startFlags, null, null, null, bOptions, false, userId, inTask, reason);
49314931 }
49324932
49334933 @Override
@@ -4947,13 +4947,20 @@ public class ActivityManagerService extends IActivityManager.Stub
49474947 final int startActivitiesInPackage(int uid, String callingPackage,
49484948 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
49494949 Bundle bOptions, int userId) {
4950+ return startActivitiesInPackage(uid, ActivityStarter.PID_NULL, UserHandle.USER_NULL,
4951+ callingPackage, intents, resolvedTypes, resultTo, bOptions, userId);
4952+ }
4953+
4954+ final int startActivitiesInPackage(int uid, int realCallingPid, int realCallingUid,
4955+ String callingPackage, Intent[] intents, String[] resolvedTypes,
4956+ IBinder resultTo, Bundle bOptions, int userId) {
49504957
49514958 final String reason = "startActivityInPackage";
49524959 userId = mUserController.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
49534960 userId, false, ALLOW_FULL_ONLY, reason, null);
49544961 // TODO: Switch to user app stacks here.
4955- int ret = mActivityStarter.startActivities(null, uid, callingPackage, intents, resolvedTypes,
4956- resultTo, bOptions, userId, reason);
4962+ int ret = mActivityStarter.startActivities(null, uid, realCallingPid, realCallingUid,
4963+ callingPackage, intents, resolvedTypes, resultTo, bOptions, userId, reason);
49574964 return ret;
49584965 }
49594966
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -4596,19 +4596,11 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
45964596 mLockTaskNotify = new LockTaskNotify(mService.mContext);
45974597 }
45984598 mLockTaskNotify.show(false);
4599- try {
4600- boolean shouldLockKeyguard = Settings.Secure.getIntForUser(
4601- mService.mContext.getContentResolver(),
4602- Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
4603- UserHandle.USER_CURRENT) != 0;
4604- if (mLockTaskModeState == LOCK_TASK_MODE_PINNED && shouldLockKeyguard) {
4605- mWindowManager.lockNow(null);
4606- mWindowManager.dismissKeyguard(null /* callback */);
4607- new LockPatternUtils(mService.mContext)
4608- .requireCredentialEntry(UserHandle.USER_ALL);
4609- }
4610- } catch (SettingNotFoundException e) {
4611- // No setting, don't lock.
4599+ if (mLockTaskModeState == LOCK_TASK_MODE_PINNED && shouldLockKeyguard()) {
4600+ mWindowManager.lockNow(null);
4601+ mWindowManager.dismissKeyguard(null /* callback */);
4602+ new LockPatternUtils(mService.mContext)
4603+ .requireCredentialEntry(UserHandle.USER_ALL);
46124604 }
46134605 } catch (RemoteException ex) {
46144606 throw new RuntimeException(ex);
@@ -4635,6 +4627,22 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
46354627 }
46364628 }
46374629
4630+ private boolean shouldLockKeyguard() {
4631+ // This functionality should be kept consistent with
4632+ // com.android.settings.security.ScreenPinningSettings (see b/127605586)
4633+ try {
4634+ return Settings.Secure.getIntForUser(
4635+ mService.mContext.getContentResolver(),
4636+ Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
4637+ UserHandle.USER_CURRENT) != 0;
4638+ } catch (Settings.SettingNotFoundException e) {
4639+ // Log to SafetyNet for b/127605586
4640+ android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, "");
4641+ LockPatternUtils lockPatternUtils = new LockPatternUtils(mService.mContext);
4642+ return lockPatternUtils.isSecure(mCurrentUser);
4643+ }
4644+ }
4645+
46384646 // TODO: Move to its own file.
46394647 /** Exactly one of these classes per Display in the system. Capable of holding zero or more
46404648 * attached {@link ActivityStack}s */
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -136,6 +136,8 @@ import java.util.Date;
136136 * an activity and associated task and stack.
137137 */
138138 class ActivityStarter {
139+ public static final int PID_NULL = 0;
140+
139141 private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStarter" : TAG_AM;
140142 private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
141143 private static final String TAG_FOCUS = TAG + POSTFIX_FOCUS;
@@ -677,6 +679,20 @@ class ActivityStarter {
677679 ProfilerInfo profilerInfo, WaitResult outResult,
678680 Configuration globalConfig, Bundle bOptions, boolean ignoreTargetSecurity, int userId,
679681 TaskRecord inTask, String reason) {
682+ return startActivityMayWait(caller, callingUid, PID_NULL, UserHandle.USER_NULL,
683+ callingPackage, intent, resolvedType, voiceSession, voiceInteractor, resultTo,
684+ resultWho, requestCode, startFlags, profilerInfo, outResult, globalConfig, bOptions,
685+ ignoreTargetSecurity, userId, inTask, reason);
686+ }
687+
688+ final int startActivityMayWait(IApplicationThread caller, int callingUid,
689+ int requestRealCallingPid, int requestRealCallingUid,
690+ String callingPackage, Intent intent, String resolvedType,
691+ IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
692+ IBinder resultTo, String resultWho, int requestCode, int startFlags,
693+ ProfilerInfo profilerInfo, WaitResult outResult,
694+ Configuration globalConfig, Bundle bOptions, boolean ignoreTargetSecurity, int userId,
695+ TaskRecord inTask, String reason) {
680696 // Refuse possible leaked file descriptors
681697 if (intent != null && intent.hasFileDescriptors()) {
682698 throw new IllegalArgumentException("File descriptors passed in Intent");
@@ -730,8 +746,14 @@ class ActivityStarter {
730746
731747 ActivityOptions options = ActivityOptions.fromBundle(bOptions);
732748 synchronized (mService) {
733- final int realCallingPid = Binder.getCallingPid();
734- final int realCallingUid = Binder.getCallingUid();
749+
750+ final int realCallingPid = requestRealCallingPid != PID_NULL
751+ ? requestRealCallingPid
752+ : Binder.getCallingPid();
753+ final int realCallingUid = requestRealCallingUid != UserHandle.USER_NULL
754+ ? requestRealCallingUid
755+ : Binder.getCallingUid();
756+
735757 int callingPid;
736758 if (callingUid >= 0) {
737759 callingPid = -1;
@@ -883,6 +905,14 @@ class ActivityStarter {
883905 final int startActivities(IApplicationThread caller, int callingUid, String callingPackage,
884906 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
885907 Bundle bOptions, int userId, String reason) {
908+ return startActivities(caller, callingUid, PID_NULL, UserHandle.USER_NULL, callingPackage,
909+ intents, resolvedTypes, resultTo, bOptions, userId, reason);
910+ }
911+
912+ final int startActivities(IApplicationThread caller, int callingUid,
913+ int incomingRealCallingPid, int incomingRealCallingUid, String callingPackage,
914+ Intent[] intents, String[] resolvedTypes, IBinder resultTo,
915+ Bundle bOptions, int userId, String reason) {
886916 if (intents == null) {
887917 throw new NullPointerException("intents is null");
888918 }
@@ -893,8 +923,13 @@ class ActivityStarter {
893923 throw new IllegalArgumentException("intents are length different than resolvedTypes");
894924 }
895925
896- final int realCallingPid = Binder.getCallingPid();
897- final int realCallingUid = Binder.getCallingUid();
926+ final int realCallingPid = incomingRealCallingPid != PID_NULL
927+ ? incomingRealCallingPid
928+ : Binder.getCallingPid();
929+
930+ final int realCallingUid = incomingRealCallingUid != UserHandle.USER_NULL
931+ ? incomingRealCallingUid
932+ : Binder.getCallingUid();
898933
899934 int callingPid;
900935 if (callingUid >= 0) {
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -332,8 +332,9 @@ final class PendingIntentRecord extends IIntentSender.Stub {
332332 }
333333 allIntents[allIntents.length-1] = finalIntent;
334334 allResolvedTypes[allResolvedTypes.length-1] = resolvedType;
335- owner.startActivitiesInPackage(uid, key.packageName, allIntents,
336- allResolvedTypes, resultTo, options, userId);
335+ owner.startActivitiesInPackage(uid, callingPid, callingUid,
336+ key.packageName, allIntents, allResolvedTypes, resultTo,
337+ options, userId);
337338 } else {
338339 owner.startActivityInPackage(uid, key.packageName, finalIntent,
339340 resolvedType, resultTo, resultWho, requestCode, 0,
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -19445,6 +19445,12 @@ public class PackageManagerService extends IPackageManager.Stub
1944519445 @Override
1944619446 public boolean isPackageDeviceAdminOnAnyUser(String packageName) {
1944719447 final int callingUid = Binder.getCallingUid();
19448+ if (checkUidPermission(android.Manifest.permission.MANAGE_USERS, callingUid)
19449+ != PERMISSION_GRANTED) {
19450+ EventLog.writeEvent(0x534e4554, "128599183", -1, "");
19451+ throw new SecurityException(android.Manifest.permission.MANAGE_USERS
19452+ + " permission is required to call this API");
19453+ }
1944819454 if (getInstantAppPackageName(callingUid) != null
1944919455 && !isCallerSameApp(packageName, callingUid)) {
1945019456 return false;
@@ -25846,11 +25852,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
2584625852 }
2584725853 if (mExternalSourcesPolicy != null) {
2584825854 int isTrusted = mExternalSourcesPolicy.getPackageTrustedToInstallApps(packageName, uid);
25849- if (isTrusted != PackageManagerInternal.ExternalSourcesPolicy.USER_DEFAULT) {
25850- return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED;
25851- }
25855+ return isTrusted == PackageManagerInternal.ExternalSourcesPolicy.USER_TRUSTED;
2585225856 }
25853- return checkUidPermission(appOpPermission, uid) == PERMISSION_GRANTED;
25857+ return false;
2585425858 }
2585525859
2585625860 @Override
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3428,6 +3428,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
34283428
34293429 @Override
34303430 public boolean isSeparateProfileChallengeAllowed(int userHandle) {
3431+ if (!isCallerWithSystemUid()) {
3432+ throw new SecurityException("Caller must be system");
3433+ }
34313434 ComponentName profileOwner = getProfileOwner(userHandle);
34323435 // Profile challenge is supported on N or newer release.
34333436 return profileOwner != null &&
Show on old repository browser