Merge "Update the failure while start activity in TaskFragment" into sc-v2-dev am: c785a6ac16
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15659009 Change-Id: I7352d6e898e8656be52e0a80c36e42e01e9ae6d8
This commit is contained in:
committed by
Automerger Merge Worker
commit
9900aed25d
@@ -56,6 +56,7 @@ import android.os.Bundle;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.util.AndroidRuntimeException;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -698,10 +699,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
.startActivityInTaskFragment(tf, activityIntent, activityOptions,
|
.startActivityInTaskFragment(tf, activityIntent, activityOptions,
|
||||||
hop.getCallingActivity());
|
hop.getCallingActivity());
|
||||||
if (!isStartResultSuccessful(result)) {
|
if (!isStartResultSuccessful(result)) {
|
||||||
final Throwable exception =
|
|
||||||
new ActivityNotFoundException("start activity in taskFragment failed");
|
|
||||||
sendTaskFragmentOperationFailure(tf.getTaskFragmentOrganizer(),
|
sendTaskFragmentOperationFailure(tf.getTaskFragmentOrganizer(),
|
||||||
errorCallbackToken, exception);
|
errorCallbackToken,
|
||||||
|
convertStartFailureToThrowable(result, activityIntent));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HIERARCHY_OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT:
|
case HIERARCHY_OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT:
|
||||||
@@ -1223,4 +1223,21 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
mService.mTaskFragmentOrganizerController
|
mService.mTaskFragmentOrganizerController
|
||||||
.onTaskFragmentError(organizer, errorCallbackToken, exception);
|
.onTaskFragmentError(organizer, errorCallbackToken, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Throwable convertStartFailureToThrowable(int result, Intent intent) {
|
||||||
|
switch (result) {
|
||||||
|
case ActivityManager.START_INTENT_NOT_RESOLVED:
|
||||||
|
case ActivityManager.START_CLASS_NOT_FOUND:
|
||||||
|
return new ActivityNotFoundException("No Activity found to handle " + intent);
|
||||||
|
case ActivityManager.START_PERMISSION_DENIED:
|
||||||
|
return new SecurityException("Permission denied and not allowed to start activity "
|
||||||
|
+ intent);
|
||||||
|
case ActivityManager.START_CANCELED:
|
||||||
|
return new AndroidRuntimeException("Activity could not be started for " + intent
|
||||||
|
+ " with error code : " + result);
|
||||||
|
default:
|
||||||
|
return new AndroidRuntimeException("Start activity failed with error code : "
|
||||||
|
+ result + " when starting " + intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user