Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

frameworks-base: Commit

frameworks/base


Commit MetaInfo

Revision5efb307d414d4d800693b60e4459341b7e5551c2 (tree)
Time2020-05-08 11:59:29
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Android 8.1.0 release 76
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCXrBHAQAKCRDorT+BmrEO
eEUHAJ4yu1Vzmb3ueuySVPcXUy4YvMirGgCghDFi30Iyw1vc8eAdlmBYeZ2Zyag=
=cGKm
-----END PGP SIGNATURE-----

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

Android 8.1.0 release 76

Change Summary

Incremental Difference

--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -68,24 +68,24 @@ public final class AssetManager implements AutoCloseable {
6868
6969 private static final String TAG = "AssetManager";
7070 private static final boolean localLOGV = false || false;
71-
71+
7272 private static final boolean DEBUG_REFS = false;
73-
73+
7474 private static final Object sSync = new Object();
7575 /*package*/ static AssetManager sSystem = null;
7676
7777 private final TypedValue mValue = new TypedValue();
7878 private final long[] mOffsets = new long[2];
79-
79+
8080 // For communication with native code.
8181 private long mObject;
8282
8383 private StringBlock mStringBlocks[] = null;
84-
84+
8585 private int mNumRefs = 1;
8686 private boolean mOpen = true;
8787 private HashMap<Long, RuntimeException> mRefStacks;
88-
88+
8989 /**
9090 * Create a new AssetManager containing only the basic system assets.
9191 * Applications will not generally use this method, instead retrieving the
@@ -114,7 +114,7 @@ public final class AssetManager implements AutoCloseable {
114114 }
115115 }
116116 }
117-
117+
118118 private AssetManager(boolean isSystem) {
119119 if (DEBUG_REFS) {
120120 synchronized (this) {
@@ -337,10 +337,10 @@ public final class AssetManager implements AutoCloseable {
337337 * Open an asset using ACCESS_STREAMING mode. This provides access to
338338 * files that have been bundled with an application as assets -- that is,
339339 * files placed in to the "assets" directory.
340- *
340+ *
341341 * @param fileName The name of the asset to open. This name can be
342342 * hierarchical.
343- *
343+ *
344344 * @see #open(String, int)
345345 * @see #list
346346 */
@@ -353,11 +353,11 @@ public final class AssetManager implements AutoCloseable {
353353 * read its contents. This provides access to files that have been bundled
354354 * with an application as assets -- that is, files placed in to the
355355 * "assets" directory.
356- *
356+ *
357357 * @param fileName The name of the asset to open. This name can be
358358 * hierarchical.
359359 * @param accessMode Desired access mode for retrieving the data.
360- *
360+ *
361361 * @see #ACCESS_UNKNOWN
362362 * @see #ACCESS_STREAMING
363363 * @see #ACCESS_RANDOM
@@ -397,14 +397,14 @@ public final class AssetManager implements AutoCloseable {
397397
398398 /**
399399 * Return a String array of all the assets at the given path.
400- *
400+ *
401401 * @param path A relative path within the assets, i.e., "docs/home.html".
402- *
402+ *
403403 * @return String[] Array of strings, one for each asset. These file
404404 * names are relative to 'path'. You can open the file by
405405 * concatenating 'path' and a name in the returned string (via
406406 * File) and passing that to open().
407- *
407+ *
408408 * @see #open
409409 */
410410 public native final String[] list(String path)
@@ -416,7 +416,7 @@ public final class AssetManager implements AutoCloseable {
416416 * provides direct access to all of the files included in an application
417417 * package (not only its assets). Applications should not normally use
418418 * this.
419- *
419+ *
420420 * @see #open(String)
421421 */
422422 public final InputStream openNonAsset(String fileName) throws IOException {
@@ -429,7 +429,7 @@ public final class AssetManager implements AutoCloseable {
429429 * provides direct access to all of the files included in an application
430430 * package (not only its assets). Applications should not normally use
431431 * this.
432- *
432+ *
433433 * @see #open(String, int)
434434 */
435435 public final InputStream openNonAsset(String fileName, int accessMode)
@@ -440,7 +440,7 @@ public final class AssetManager implements AutoCloseable {
440440 /**
441441 * {@hide}
442442 * Open a non-asset in a specified package. Not for use by applications.
443- *
443+ *
444444 * @param cookie Identifier of the package to be opened.
445445 * @param fileName Name of the asset to retrieve.
446446 */
@@ -452,7 +452,7 @@ public final class AssetManager implements AutoCloseable {
452452 /**
453453 * {@hide}
454454 * Open a non-asset in a specified package. Not for use by applications.
455- *
455+ *
456456 * @param cookie Identifier of the package to be opened.
457457 * @param fileName Name of the asset to retrieve.
458458 * @param accessMode Desired access mode for retrieving the data.
@@ -477,7 +477,7 @@ public final class AssetManager implements AutoCloseable {
477477 throws IOException {
478478 return openNonAssetFd(0, fileName);
479479 }
480-
480+
481481 public final AssetFileDescriptor openNonAssetFd(int cookie,
482482 String fileName) throws IOException {
483483 synchronized (this) {
@@ -492,20 +492,20 @@ public final class AssetManager implements AutoCloseable {
492492 }
493493 throw new FileNotFoundException("Asset absolute file: " + fileName);
494494 }
495-
495+
496496 /**
497497 * Retrieve a parser for a compiled XML file.
498- *
498+ *
499499 * @param fileName The name of the file to retrieve.
500500 */
501501 public final XmlResourceParser openXmlResourceParser(String fileName)
502502 throws IOException {
503503 return openXmlResourceParser(0, fileName);
504504 }
505-
505+
506506 /**
507507 * Retrieve a parser for a compiled XML file.
508- *
508+ *
509509 * @param cookie Identifier of the package to be opened.
510510 * @param fileName The name of the file to retrieve.
511511 */
@@ -521,7 +521,7 @@ public final class AssetManager implements AutoCloseable {
521521 * {@hide}
522522 * Retrieve a non-asset as a compiled XML file. Not for use by
523523 * applications.
524- *
524+ *
525525 * @param fileName The name of the file to retrieve.
526526 */
527527 /*package*/ final XmlBlock openXmlBlockAsset(String fileName)
@@ -533,7 +533,7 @@ public final class AssetManager implements AutoCloseable {
533533 * {@hide}
534534 * Retrieve a non-asset as a compiled XML file. Not for use by
535535 * applications.
536- *
536+ *
537537 * @param cookie Identifier of the package to be opened.
538538 * @param fileName Name of the asset to retrieve.
539539 */
@@ -588,12 +588,18 @@ public final class AssetManager implements AutoCloseable {
588588 }
589589 }
590590 }
591- destroy();
591+
592+ synchronized (this) {
593+ if (mObject != 0) {
594+ destroy();
595+ mObject = 0;
596+ }
597+ }
592598 } finally {
593599 super.finalize();
594600 }
595601 }
596-
602+
597603 public final class AssetInputStream extends InputStream {
598604 /**
599605 * @hide
@@ -796,7 +802,7 @@ public final class AssetManager implements AutoCloseable {
796802 /*package*/ native final String getResourcePackageName(int resid);
797803 /*package*/ native final String getResourceTypeName(int resid);
798804 /*package*/ native final String getResourceEntryName(int resid);
799-
805+
800806 private native final long openAsset(String fileName, int accessMode);
801807 private final native ParcelFileDescriptor openAssetFd(String fileName,
802808 long[] outOffsets) throws IOException;
@@ -856,17 +862,17 @@ public final class AssetManager implements AutoCloseable {
856862 * {@hide}
857863 */
858864 public native static final int getGlobalAssetCount();
859-
865+
860866 /**
861867 * {@hide}
862868 */
863869 public native static final String getAssetAllocations();
864-
870+
865871 /**
866872 * {@hide}
867873 */
868874 public native static final int getGlobalAssetManagerCount();
869-
875+
870876 private native final long newTheme();
871877 private native final void deleteTheme(long theme);
872878 /*package*/ native static final void applyThemeStyle(long theme, int styleRes, boolean force);
@@ -899,7 +905,7 @@ public final class AssetManager implements AutoCloseable {
899905 }
900906 mNumRefs++;
901907 }
902-
908+
903909 private final void decRefsLocked(long id) {
904910 if (DEBUG_REFS && mRefStacks != null) {
905911 mRefStacks.remove(id);
@@ -907,8 +913,9 @@ public final class AssetManager implements AutoCloseable {
907913 mNumRefs--;
908914 //System.out.println("Dec streams: mNumRefs=" + mNumRefs
909915 // + " mReleased=" + mReleased);
910- if (mNumRefs == 0) {
916+ if (mNumRefs == 0 && mObject != 0) {
911917 destroy();
918+ mObject = 0;
912919 }
913920 }
914921 }
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2838,6 +2838,11 @@
28382838 <permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS"
28392839 android:protectionLevel="signature|privileged" />
28402840
2841+ <!-- Allows an application to manage the companion devices.
2842+ @hide -->
2843+ <permission android:name="android.permission.MANAGE_COMPANION_DEVICES"
2844+ android:protectionLevel="signature" />
2845+
28412846 <!-- @SystemApi Allows an application to use SurfaceFlinger's low level features.
28422847 <p>Not for use by third-party applications.
28432848 @hide
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -50,6 +50,7 @@ applications that come with the platform
5050 <permission name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
5151 <permission name="android.permission.GET_ACCOUNTS_PRIVILEGED"/>
5252 <permission name="android.permission.MODIFY_PHONE_STATE"/>
53+ <permission name="android.permission.STATUS_BAR"/>
5354 <permission name="android.permission.STOP_APP_SWITCHES"/>
5455 <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
5556 <permission name="com.android.voicemail.permission.WRITE_VOICEMAIL"/>
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -624,6 +624,11 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
624624 + "associate USER_ID PACKAGE MAC_ADDRESS\n"
625625 + "disassociate USER_ID PACKAGE MAC_ADDRESS";
626626
627+ ShellCmd() {
628+ getContext().enforceCallingOrSelfPermission(
629+ android.Manifest.permission.MANAGE_COMPANION_DEVICES, "ShellCmd");
630+ }
631+
627632 @Override
628633 public int onCommand(String cmd) {
629634 switch (cmd) {
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -6916,7 +6916,7 @@ public class ActivityManagerService extends IActivityManager.Stub
69166916 }
69176917 }
69186918
6919- private final boolean attachApplicationLocked(IApplicationThread thread,
6919+ private boolean attachApplicationLocked(@NonNull IApplicationThread thread,
69206920 int pid) {
69216921
69226922 // Find the application record that is being attached... either via
@@ -7221,6 +7221,9 @@ public class ActivityManagerService extends IActivityManager.Stub
72217221
72227222 @Override
72237223 public final void attachApplication(IApplicationThread thread) {
7224+ if (thread == null) {
7225+ throw new SecurityException("Invalid application interface");
7226+ }
72247227 synchronized (this) {
72257228 int callingPid = Binder.getCallingPid();
72267229 final long origId = Binder.clearCallingIdentity();
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -3961,6 +3961,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
39613961
39623962 final boolean navigateUpToLocked(ActivityRecord srec, Intent destIntent, int resultCode,
39633963 Intent resultData) {
3964+ if (srec.app == null || srec.app.thread == null) {
3965+ // Nothing to do if the caller is not attached, because this method should be called
3966+ // from an alive activity.
3967+ return false;
3968+ }
39643969 final TaskRecord task = srec.getTask();
39653970 final ArrayList<ActivityRecord> activities = task.mActivities;
39663971 final int start = activities.indexOf(srec);
@@ -4012,22 +4017,22 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
40124017 }
40134018
40144019 if (parent != null && foundParentInTask) {
4020+ final int callingUid = srec.info.applicationInfo.uid;
40154021 final int parentLaunchMode = parent.info.launchMode;
40164022 final int destIntentFlags = destIntent.getFlags();
40174023 if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE ||
40184024 parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK ||
40194025 parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP ||
40204026 (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
4021- parent.deliverNewIntentLocked(srec.info.applicationInfo.uid, destIntent,
4022- srec.packageName);
4027+ parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName);
40234028 } else {
40244029 try {
40254030 ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
40264031 destIntent.getComponent(), 0, srec.userId);
40274032 int res = mService.mActivityStarter.startActivityLocked(srec.app.thread,
40284033 destIntent, null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null,
4029- null, parent.appToken, null, 0, -1, parent.launchedFromUid,
4030- parent.launchedFromPackage, -1, parent.launchedFromUid, 0, null,
4034+ null, parent.appToken, null, 0, -1, callingUid,
4035+ srec.packageName, -1, callingUid, 0, null,
40314036 false, true, null, null, "navigateUpTo");
40324037 foundParentInTask = res == ActivityManager.START_SUCCESS;
40334038 } catch (RemoteException e) {
--- a/services/core/java/com/android/server/am/ActivityStarter.java
+++ b/services/core/java/com/android/server/am/ActivityStarter.java
@@ -940,6 +940,8 @@ class ActivityStarter {
940940 } else {
941941 callingPid = callingUid = -1;
942942 }
943+ boolean forceNewTask = false;
944+ final int filterCallingUid = callingUid >= 0 ? callingUid : realCallingUid;
943945 final long origId = Binder.clearCallingIdentity();
944946 try {
945947 synchronized (mService) {
@@ -959,6 +961,9 @@ class ActivityStarter {
959961
960962 // Don't modify the client's object!
961963 intent = new Intent(intent);
964+ if (forceNewTask) {
965+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
966+ }
962967
963968 // Collect information about the target of the Intent.
964969 ActivityInfo aInfo = mSupervisor.resolveActivity(intent, resolvedTypes[i], 0,
@@ -984,7 +989,17 @@ class ActivityStarter {
984989 return res;
985990 }
986991
987- resultTo = outActivity[0] != null ? outActivity[0].appToken : null;
992+ final ActivityRecord started = outActivity[0];
993+ if (started != null && started.getUid() == filterCallingUid) {
994+ // Only the started activity which has the same uid as the source caller can
995+ // be the caller of next activity.
996+ resultTo = started.appToken;
997+ forceNewTask = false;
998+ } else {
999+ // Different apps not adjacent to the caller are forced to be new task.
1000+ resultTo = null;
1001+ forceNewTask = true;
1002+ }
9881003 }
9891004 }
9901005 } finally {
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -19029,40 +19029,54 @@ public class PackageManagerService extends IPackageManager.Stub
1902919029 int count = 0;
1903019030 final String packageName = pkg.packageName;
1903119031
19032+ boolean handlesWebUris = false;
19033+ final boolean alreadyVerified;
1903219034 synchronized (mPackages) {
1903319035 // If this is a new install and we see that we've already run verification for this
1903419036 // package, we have nothing to do: it means the state was restored from backup.
19035- if (!replacing) {
19036- IntentFilterVerificationInfo ivi =
19037- mSettings.getIntentFilterVerificationLPr(packageName);
19038- if (ivi != null) {
19039- if (DEBUG_DOMAIN_VERIFICATION) {
19040- Slog.i(TAG, "Package " + packageName+ " already verified: status="
19041- + ivi.getStatusString());
19042- }
19043- return;
19037+ final IntentFilterVerificationInfo ivi =
19038+ mSettings.getIntentFilterVerificationLPr(packageName);
19039+ alreadyVerified = (ivi != null);
19040+ if (!replacing && alreadyVerified) {
19041+ if (DEBUG_DOMAIN_VERIFICATION) {
19042+ Slog.i(TAG, "Package " + packageName + " already verified: status="
19043+ + ivi.getStatusString());
1904419044 }
19045+ return;
1904519046 }
1904619047
19047- // If any filters need to be verified, then all need to be.
19048+ // If any filters need to be verified, then all need to be. In addition, we need to
19049+ // know whether an updating app has any web navigation intent filters, to re-
19050+ // examine handling policy even if not re-verifying.
1904819051 boolean needToVerify = false;
1904919052 for (PackageParser.Activity a : pkg.activities) {
1905019053 for (ActivityIntentInfo filter : a.intents) {
19054+ if (filter.handlesWebUris(true)) {
19055+ handlesWebUris = true;
19056+ }
1905119057 if (filter.needsVerification() && needsNetworkVerificationLPr(filter)) {
1905219058 if (DEBUG_DOMAIN_VERIFICATION) {
1905319059 Slog.d(TAG, "Intent filter needs verification, so processing all filters");
1905419060 }
1905519061 needToVerify = true;
19062+ // It's safe to break out here because filter.needsVerification()
19063+ // can only be true if filter.handlesWebUris(true) returns true, so
19064+ // we've already noted that.
1905619065 break;
1905719066 }
1905819067 }
1905919068 }
1906019069
19070+ // Note whether this app publishes any web navigation handling support at all,
19071+ // and whether there are any web-nav filters that fit the profile for running
19072+ // a verification pass now.
1906119073 if (needToVerify) {
1906219074 final int verificationId = mIntentFilterVerificationToken++;
1906319075 for (PackageParser.Activity a : pkg.activities) {
1906419076 for (ActivityIntentInfo filter : a.intents) {
19065- if (filter.handlesWebUris(true) && needsNetworkVerificationLPr(filter)) {
19077+ // Run verification against hosts mentioned in any web-nav intent filter,
19078+ // even if the filter matches non-web schemes as well
19079+ if (filter.handlesWebUris(false) && needsNetworkVerificationLPr(filter)) {
1906619080 if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
1906719081 "Verification needed for IntentFilter:" + filter.toString());
1906819082 mIntentFilterVerifier.addOneIntentFilterVerification(
@@ -19075,13 +19089,23 @@ public class PackageManagerService extends IPackageManager.Stub
1907519089 }
1907619090
1907719091 if (count > 0) {
19092+ // count > 0 means that we're running a full verification pass
1907819093 if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Starting " + count
1907919094 + " IntentFilter verification" + (count > 1 ? "s" : "")
1908019095 + " for userId:" + userId);
1908119096 mIntentFilterVerifier.startVerifications(userId);
19097+ } else if (alreadyVerified && handlesWebUris) {
19098+ // App used autoVerify in the past, no longer does, but still handles web
19099+ // navigation starts.
19100+ if (DEBUG_DOMAIN_VERIFICATION) {
19101+ Slog.d(TAG, "App changed web filters but no longer verifying - resetting policy");
19102+ }
19103+ synchronized (mPackages) {
19104+ clearIntentFilterVerificationsLPw(packageName, userId);
19105+ }
1908219106 } else {
1908319107 if (DEBUG_DOMAIN_VERIFICATION) {
19084- Slog.d(TAG, "No filters or not all autoVerify for " + packageName);
19108+ Slog.d(TAG, "No web filters or no prior verify policy for " + packageName);
1908519109 }
1908619110 }
1908719111 }
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -1380,6 +1380,7 @@ final class Settings {
13801380 return false;
13811381 }
13821382 ps.clearDomainVerificationStatusForUser(userId);
1383+ ps.setIntentFilterVerificationInfo(null);
13831384 return true;
13841385 }
13851386
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
@@ -122,4 +122,17 @@ public class ActivityStackTests extends ActivityTestsBase {
122122 assertEquals(task.getTopActivity(true /* includeOverlays */), taskOverlay);
123123 assertNotNull(result.r);
124124 }
125+
126+ @Test
127+ public void testNavigateUpTo() {
128+ final ActivityManagerService service = createActivityManagerService();
129+ final TaskRecord task = createTask(service, testActivityComponent, TEST_STACK_ID);
130+ final ActivityRecord activityRecord = createActivity(service, testActivityComponent, task);
131+ activityRecord.app = new ProcessRecord(null, activityRecord.appInfo,
132+ activityRecord.processName, activityRecord.getUid());
133+ final ActivityStack testStack = service.mStackSupervisor.getStack(TEST_STACK_ID);
134+ // No-op if the source activity record doesn't have attached process (app.thread == null).
135+ assertFalse(testStack.navigateUpToLocked(activityRecord, activityRecord.intent,
136+ 0 /* resultCode */, null /* resultData */));
137+ }
125138 }
Show on old repository browser