Loading core/java/android/content/pm/PackageInstaller.java +2 −0 Original line number Diff line number Diff line Loading @@ -2082,6 +2082,7 @@ public class PackageInstaller { /** * Get the value set in {@link SessionParams#setOriginatingUri(Uri)}. * Note: This value will only be non-null for the owner of the session. */ public @Nullable Uri getOriginatingUri() { return originatingUri; Loading @@ -2096,6 +2097,7 @@ public class PackageInstaller { /** * Get the value set in {@link SessionParams#setReferrerUri(Uri)} * Note: This value will only be non-null for the owner of the session. */ public @Nullable Uri getReferrerUri() { return referrerUri; Loading core/tests/bugreports/src/android/server/bugreports/BugreportManagerTest.java +41 −8 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ public class BugreportManagerTest { private Handler mHandler; private Executor mExecutor; private BugreportManager mBrm; private File mBugreportFile; private File mScreenshotFile; private ParcelFileDescriptor mBugreportFd; private ParcelFileDescriptor mScreenshotFd; Loading @@ -73,8 +75,10 @@ public class BugreportManagerTest { }; mBrm = getBugreportManager(); mBugreportFd = parcelFd("bugreport_" + name.getMethodName(), ".zip"); mScreenshotFd = parcelFd("screenshot_" + name.getMethodName(), ".png"); mBugreportFile = createTempFile("bugreport_" + name.getMethodName(), ".zip"); mScreenshotFile = createTempFile("screenshot_" + name.getMethodName(), ".png"); mBugreportFd = parcelFd(mBugreportFile); mScreenshotFd = parcelFd(mScreenshotFile); getPermissions(); } Loading Loading @@ -120,6 +124,21 @@ public class BugreportManagerTest { assertFdsAreClosed(mBugreportFd); } @Test public void normalFlow_full() throws Exception { BugreportCallbackImpl callback = new BugreportCallbackImpl(); mBrm.startBugreport(mBugreportFd, mScreenshotFd, full(), mExecutor, callback); waitTillDoneOrTimeout(callback); assertThat(callback.isDone()).isTrue(); assertThat(callback.getErrorCode()).isEqualTo( BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT); // bugreport and screenshot files should be empty when user consent timed out. assertThat(mBugreportFile.length()).isEqualTo(0); assertThat(mScreenshotFile.length()).isEqualTo(0); assertFdsAreClosed(mBugreportFd, mScreenshotFd); } @Test public void simultaneousBugreportsNotAllowed() throws Exception { // Start bugreport #1 Loading @@ -129,9 +148,10 @@ public class BugreportManagerTest { // Before #1 is done, try to start #2. assertThat(callback.isDone()).isFalse(); BugreportCallbackImpl callback2 = new BugreportCallbackImpl(); ParcelFileDescriptor bugreportFd2 = parcelFd("bugreport_2_" + name.getMethodName(), ".zip"); ParcelFileDescriptor screenshotFd2 = parcelFd("screenshot_2_" + name.getMethodName(), ".png"); File bugreportFile2 = createTempFile("bugreport_2_" + name.getMethodName(), ".zip"); File screenshotFile2 = createTempFile("screenshot_2_" + name.getMethodName(), ".png"); ParcelFileDescriptor bugreportFd2 = parcelFd(bugreportFile2); ParcelFileDescriptor screenshotFd2 = parcelFd(screenshotFile2); mBrm.startBugreport(bugreportFd2, screenshotFd2, wifi(), mExecutor, callback2); Thread.sleep(500 /* .5s */); Loading Loading @@ -271,12 +291,16 @@ public class BugreportManagerTest { return bm; } private static ParcelFileDescriptor parcelFd(String prefix, String extension) throws Exception { File f = File.createTempFile(prefix, extension); private static File createTempFile(String prefix, String extension) throws Exception { final File f = File.createTempFile(prefix, extension); f.setReadable(true, true); f.setWritable(true, true); f.deleteOnExit(); return f; } return ParcelFileDescriptor.open(f, private static ParcelFileDescriptor parcelFd(File file) throws Exception { return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_APPEND); } Loading Loading @@ -342,4 +366,13 @@ public class BugreportManagerTest { private static BugreportParams interactive() { return new BugreportParams(BugreportParams.BUGREPORT_MODE_INTERACTIVE); } /* * Returns a {@link BugreportParams} for full bugreport that includes a screenshot. * * <p> This can take on the order of minutes to finish */ private static BugreportParams full() { return new BugreportParams(BugreportParams.BUGREPORT_MODE_FULL); } } location/java/com/android/internal/location/GpsNetInitiatedHandler.java +1 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.internal.location; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading Loading @@ -392,13 +391,9 @@ public class GpsNetInitiatedHandler { mNiNotificationBuilder.setDefaults(0); } // if not to popup dialog immediately, pending intent will open the dialog Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent(); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0); mNiNotificationBuilder.setTicker(getNotifTicker(notif, mContext)) .setContentTitle(title) .setContentText(message) .setContentIntent(pi); .setContentText(message); notificationManager.notifyAsUser(null, notif.notificationId, mNiNotificationBuilder.build(), UserHandle.ALL); Loading packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +1 −1 Original line number Diff line number Diff line Loading @@ -362,7 +362,7 @@ public class RecordingService extends Service { this, REQUEST_CODE, viewIntent, Intent.FLAG_GRANT_READ_URI_PERMISSION)) PendingIntent.FLAG_IMMUTABLE)) .addAction(shareAction) .addAction(deleteAction) .setAutoCancel(true); Loading packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java +6 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,13 @@ public class LeakReporter { .setContentText(String.format( "SystemUI has detected %d leaked objects. Tap to send", garbageCount)) .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) .setContentIntent(PendingIntent.getActivityAsUser(mContext, 0, .setContentIntent(PendingIntent.getActivityAsUser( mContext, 0, getIntent(hprofFile, dumpFile), PendingIntent.FLAG_UPDATE_CURRENT, null, UserHandle.CURRENT)); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.CURRENT)); notiMan.notify(TAG, 0, builder.build()); } catch (IOException e) { Log.e(TAG, "Couldn't dump heap for leak", e); Loading Loading
core/java/android/content/pm/PackageInstaller.java +2 −0 Original line number Diff line number Diff line Loading @@ -2082,6 +2082,7 @@ public class PackageInstaller { /** * Get the value set in {@link SessionParams#setOriginatingUri(Uri)}. * Note: This value will only be non-null for the owner of the session. */ public @Nullable Uri getOriginatingUri() { return originatingUri; Loading @@ -2096,6 +2097,7 @@ public class PackageInstaller { /** * Get the value set in {@link SessionParams#setReferrerUri(Uri)} * Note: This value will only be non-null for the owner of the session. */ public @Nullable Uri getReferrerUri() { return referrerUri; Loading
core/tests/bugreports/src/android/server/bugreports/BugreportManagerTest.java +41 −8 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ public class BugreportManagerTest { private Handler mHandler; private Executor mExecutor; private BugreportManager mBrm; private File mBugreportFile; private File mScreenshotFile; private ParcelFileDescriptor mBugreportFd; private ParcelFileDescriptor mScreenshotFd; Loading @@ -73,8 +75,10 @@ public class BugreportManagerTest { }; mBrm = getBugreportManager(); mBugreportFd = parcelFd("bugreport_" + name.getMethodName(), ".zip"); mScreenshotFd = parcelFd("screenshot_" + name.getMethodName(), ".png"); mBugreportFile = createTempFile("bugreport_" + name.getMethodName(), ".zip"); mScreenshotFile = createTempFile("screenshot_" + name.getMethodName(), ".png"); mBugreportFd = parcelFd(mBugreportFile); mScreenshotFd = parcelFd(mScreenshotFile); getPermissions(); } Loading Loading @@ -120,6 +124,21 @@ public class BugreportManagerTest { assertFdsAreClosed(mBugreportFd); } @Test public void normalFlow_full() throws Exception { BugreportCallbackImpl callback = new BugreportCallbackImpl(); mBrm.startBugreport(mBugreportFd, mScreenshotFd, full(), mExecutor, callback); waitTillDoneOrTimeout(callback); assertThat(callback.isDone()).isTrue(); assertThat(callback.getErrorCode()).isEqualTo( BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT); // bugreport and screenshot files should be empty when user consent timed out. assertThat(mBugreportFile.length()).isEqualTo(0); assertThat(mScreenshotFile.length()).isEqualTo(0); assertFdsAreClosed(mBugreportFd, mScreenshotFd); } @Test public void simultaneousBugreportsNotAllowed() throws Exception { // Start bugreport #1 Loading @@ -129,9 +148,10 @@ public class BugreportManagerTest { // Before #1 is done, try to start #2. assertThat(callback.isDone()).isFalse(); BugreportCallbackImpl callback2 = new BugreportCallbackImpl(); ParcelFileDescriptor bugreportFd2 = parcelFd("bugreport_2_" + name.getMethodName(), ".zip"); ParcelFileDescriptor screenshotFd2 = parcelFd("screenshot_2_" + name.getMethodName(), ".png"); File bugreportFile2 = createTempFile("bugreport_2_" + name.getMethodName(), ".zip"); File screenshotFile2 = createTempFile("screenshot_2_" + name.getMethodName(), ".png"); ParcelFileDescriptor bugreportFd2 = parcelFd(bugreportFile2); ParcelFileDescriptor screenshotFd2 = parcelFd(screenshotFile2); mBrm.startBugreport(bugreportFd2, screenshotFd2, wifi(), mExecutor, callback2); Thread.sleep(500 /* .5s */); Loading Loading @@ -271,12 +291,16 @@ public class BugreportManagerTest { return bm; } private static ParcelFileDescriptor parcelFd(String prefix, String extension) throws Exception { File f = File.createTempFile(prefix, extension); private static File createTempFile(String prefix, String extension) throws Exception { final File f = File.createTempFile(prefix, extension); f.setReadable(true, true); f.setWritable(true, true); f.deleteOnExit(); return f; } return ParcelFileDescriptor.open(f, private static ParcelFileDescriptor parcelFd(File file) throws Exception { return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_APPEND); } Loading Loading @@ -342,4 +366,13 @@ public class BugreportManagerTest { private static BugreportParams interactive() { return new BugreportParams(BugreportParams.BUGREPORT_MODE_INTERACTIVE); } /* * Returns a {@link BugreportParams} for full bugreport that includes a screenshot. * * <p> This can take on the order of minutes to finish */ private static BugreportParams full() { return new BugreportParams(BugreportParams.BUGREPORT_MODE_FULL); } }
location/java/com/android/internal/location/GpsNetInitiatedHandler.java +1 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.internal.location; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading Loading @@ -392,13 +391,9 @@ public class GpsNetInitiatedHandler { mNiNotificationBuilder.setDefaults(0); } // if not to popup dialog immediately, pending intent will open the dialog Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent(); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0); mNiNotificationBuilder.setTicker(getNotifTicker(notif, mContext)) .setContentTitle(title) .setContentText(message) .setContentIntent(pi); .setContentText(message); notificationManager.notifyAsUser(null, notif.notificationId, mNiNotificationBuilder.build(), UserHandle.ALL); Loading
packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +1 −1 Original line number Diff line number Diff line Loading @@ -362,7 +362,7 @@ public class RecordingService extends Service { this, REQUEST_CODE, viewIntent, Intent.FLAG_GRANT_READ_URI_PERMISSION)) PendingIntent.FLAG_IMMUTABLE)) .addAction(shareAction) .addAction(deleteAction) .setAutoCancel(true); Loading
packages/SystemUI/src/com/android/systemui/util/leak/LeakReporter.java +6 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,13 @@ public class LeakReporter { .setContentText(String.format( "SystemUI has detected %d leaked objects. Tap to send", garbageCount)) .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) .setContentIntent(PendingIntent.getActivityAsUser(mContext, 0, .setContentIntent(PendingIntent.getActivityAsUser( mContext, 0, getIntent(hprofFile, dumpFile), PendingIntent.FLAG_UPDATE_CURRENT, null, UserHandle.CURRENT)); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, null, UserHandle.CURRENT)); notiMan.notify(TAG, 0, builder.build()); } catch (IOException e) { Log.e(TAG, "Couldn't dump heap for leak", e); Loading