Merge "Stop throwing exception when re-starting MediaProjection"

This commit is contained in:
TreeHugger Robot
2018-11-19 09:38:17 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 2 deletions

View File

@@ -90,6 +90,8 @@ public final class MediaProjectionManager {
* int, android.content.Intent)}
* @param resultData The resulting data from {@link android.app.Activity#onActivityResult(int,
* int, android.content.Intent)}
* @throws IllegalStateException on pre-Q devices if a previously gotten MediaProjection
* from the same {@code resultData} has not yet been stopped
*/
public MediaProjection getMediaProjection(int resultCode, @NonNull Intent resultData) {
if (resultCode != Activity.RESULT_OK || resultData == null) {

View File

@@ -396,8 +396,9 @@ public final class MediaProjectionManagerService extends SystemService
}
synchronized (mLock) {
if (isValidMediaProjection(asBinder())) {
throw new IllegalStateException(
"Cannot start already started MediaProjection");
Slog.w(TAG, "UID " + Binder.getCallingUid()
+ " attempted to start already started MediaProjection");
return;
}
mCallback = callback;
registerCallback(mCallback);