Merge "Partially return NEW_PICTURE and NEW_VIDEO."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d81542cef4
@@ -14463,7 +14463,7 @@ package android.hardware {
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void unlock();
|
||||
field public static final deprecated java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final deprecated java.lang.String ACTION_NEW_VIDEO = "android.hardware.action.NEW_VIDEO";
|
||||
field public static final int CAMERA_ERROR_EVICTED = 2; // 0x2
|
||||
field public static final int CAMERA_ERROR_SERVER_DIED = 100; // 0x64
|
||||
|
||||
@@ -15188,7 +15188,7 @@ package android.hardware {
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void unlock();
|
||||
field public static final deprecated java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final deprecated java.lang.String ACTION_NEW_VIDEO = "android.hardware.action.NEW_VIDEO";
|
||||
field public static final int CAMERA_ERROR_EVICTED = 2; // 0x2
|
||||
field public static final int CAMERA_ERROR_SERVER_DIED = 100; // 0x64
|
||||
|
||||
@@ -14512,7 +14512,7 @@ package android.hardware {
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
|
||||
method public final void unlock();
|
||||
field public static final deprecated java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final java.lang.String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
field public static final deprecated java.lang.String ACTION_NEW_VIDEO = "android.hardware.action.NEW_VIDEO";
|
||||
field public static final int CAMERA_ERROR_EVICTED = 2; // 0x2
|
||||
field public static final int CAMERA_ERROR_SERVER_DIED = 100; // 0x64
|
||||
|
||||
@@ -178,24 +178,39 @@ public class Camera {
|
||||
private static final int NO_ERROR = 0;
|
||||
|
||||
/**
|
||||
* @deprecated This broadcast is no longer delivered by the system; use
|
||||
* {@link android.app.job.JobInfo.Builder JobInfo.Builder}.{@link android.app.job.JobInfo.Builder#addTriggerContentUri}
|
||||
* instead.
|
||||
* Broadcast Action: A new picture is taken by the camera, and the entry of
|
||||
* the picture has been added to the media store.
|
||||
* {@link android.content.Intent#getData} is URI of the picture.
|
||||
*
|
||||
* <p>In {@link android.os.Build.VERSION_CODES#N Android N} this broadcast was removed, and
|
||||
* applications are recommended to use
|
||||
* {@link android.app.job.JobInfo.Builder JobInfo.Builder}.{@link android.app.job.JobInfo.Builder#addTriggerContentUri}
|
||||
* instead.</p>
|
||||
*
|
||||
* <p>In {@link android.os.Build.VERSION_CODES#O Android O} this broadcast has been brought
|
||||
* back, but only for <em>registered</em> receivers. Apps that are actively running can
|
||||
* against listen to the broadcast if they want an immediate clear signal about a picture
|
||||
* being taken, however anything doing heavy work (or needing to be launched) as a result of
|
||||
* this should still use JobScheduler.</p>
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||
@Deprecated
|
||||
public static final String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
|
||||
|
||||
/**
|
||||
* @deprecated This broadcast is no longer delivered by the system; use
|
||||
* {@link android.app.job.JobInfo.Builder JobInfo.Builder}.{@link android.app.job.JobInfo.Builder#addTriggerContentUri}
|
||||
* instead.
|
||||
* Broadcast Action: A new video is recorded by the camera, and the entry
|
||||
* of the video has been added to the media store.
|
||||
* {@link android.content.Intent#getData} is URI of the video.
|
||||
*
|
||||
* <p>In {@link android.os.Build.VERSION_CODES#N Android N} this broadcast was removed, and
|
||||
* applications are recommended to use
|
||||
* {@link android.app.job.JobInfo.Builder JobInfo.Builder}.{@link android.app.job.JobInfo.Builder#addTriggerContentUri}
|
||||
* instead.</p>
|
||||
*
|
||||
* <p>In {@link android.os.Build.VERSION_CODES#O Android O} this broadcast has been brought
|
||||
* back, but only for <em>registered</em> receivers. Apps that are actively running can
|
||||
* against listen to the broadcast if they want an immediate clear signal about a video
|
||||
* being taken, however anything doing heavy work (or needing to be launched) as a result of
|
||||
* this should still use JobScheduler.</p>
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||
@Deprecated
|
||||
|
||||
@@ -19032,26 +19032,13 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
break;
|
||||
case android.hardware.Camera.ACTION_NEW_PICTURE:
|
||||
case android.hardware.Camera.ACTION_NEW_VIDEO:
|
||||
// These broadcasts are no longer allowed by the system, since they can
|
||||
// cause significant thrashing at a crictical point (using the camera).
|
||||
// Apps should use JobScehduler to monitor for media provider changes.
|
||||
Slog.w(TAG, action + " no longer allowed; dropping from "
|
||||
+ UserHandle.formatUid(callingUid));
|
||||
if (resultTo != null) {
|
||||
final BroadcastQueue queue = broadcastQueueForIntent(intent);
|
||||
try {
|
||||
queue.performReceiveLocked(callerApp, resultTo, intent,
|
||||
Activity.RESULT_CANCELED, null, null,
|
||||
false, false, userId);
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failure ["
|
||||
+ queue.mQueueName + "] sending broadcast result of "
|
||||
+ intent, e);
|
||||
|
||||
}
|
||||
}
|
||||
// Lie; we don't want to crash the app.
|
||||
return ActivityManager.BROADCAST_SUCCESS;
|
||||
// In N we just turned these off; in O we are turing them back on partly,
|
||||
// only for registered receivers. This will still address the main problem
|
||||
// (a spam of apps waking up when a picture is taken putting significant
|
||||
// memory pressure on the system at a bad point), while still allowing apps
|
||||
// that are already actively running to know about this happening.
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
||||
break;
|
||||
case android.security.KeyChain.ACTION_TRUST_STORE_CHANGED:
|
||||
mHandler.sendEmptyMessage(HANDLE_TRUST_STORAGE_UPDATE_MSG);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user