1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.app; 18 19 import android.app.ActivityManager; 20 import android.app.IRequestFinishCallback; 21 import android.app.PictureInPictureParams; 22 import android.content.ComponentName; 23 import android.content.Intent; 24 import android.content.res.Configuration; 25 import android.os.Bundle; 26 import android.os.PersistableBundle; 27 import android.view.RemoteAnimationDefinition; 28 import android.window.SizeConfigurationBuckets; 29 30 import com.android.internal.policy.IKeyguardDismissCallback; 31 32 /** 33 * Interface for the callback and request from an activity to system. 34 * 35 * {@hide} 36 */ 37 interface IActivityClientController { activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling)38 oneway void activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling); activityResumed(in IBinder token, in boolean handleSplashScreenExit)39 oneway void activityResumed(in IBinder token, in boolean handleSplashScreenExit); 40 /** 41 * This call is not one-way because {@link #activityPaused()) is not one-way, or 42 * the top-resumed-lost could be reported after activity paused. 43 */ activityTopResumedStateLost()44 void activityTopResumedStateLost(); 45 /** 46 * Notifies that the activity has completed paused. This call is not one-way because it can make 47 * consecutive launch in the same process more coherent. About the order of binder call, it 48 * should be fine with other one-way calls because if pause hasn't completed on the server side, 49 * there won't be other lifecycle changes. 50 */ activityPaused(in IBinder token)51 void activityPaused(in IBinder token); activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description)52 oneway void activityStopped(in IBinder token, in Bundle state, 53 in PersistableBundle persistentState, in CharSequence description); activityDestroyed(in IBinder token)54 oneway void activityDestroyed(in IBinder token); activityRelaunched(in IBinder token)55 oneway void activityRelaunched(in IBinder token); 56 reportSizeConfigurations(in IBinder token, in SizeConfigurationBuckets sizeConfigurations)57 oneway void reportSizeConfigurations(in IBinder token, 58 in SizeConfigurationBuckets sizeConfigurations); moveActivityTaskToBack(in IBinder token, boolean nonRoot)59 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot); shouldUpRecreateTask(in IBinder token, in String destAffinity)60 boolean shouldUpRecreateTask(in IBinder token, in String destAffinity); navigateUpTo(in IBinder token, in Intent target, int resultCode, in Intent resultData)61 boolean navigateUpTo(in IBinder token, in Intent target, int resultCode, 62 in Intent resultData); releaseActivityInstance(in IBinder token)63 boolean releaseActivityInstance(in IBinder token); finishActivity(in IBinder token, int code, in Intent data, int finishTask)64 boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); finishActivityAffinity(in IBinder token)65 boolean finishActivityAffinity(in IBinder token); 66 /** Finish all activities that were started for result from the specified activity. */ finishSubActivity(in IBinder token, in String resultWho, int requestCode)67 void finishSubActivity(in IBinder token, in String resultWho, int requestCode); 68 isTopOfTask(in IBinder token)69 boolean isTopOfTask(in IBinder token); willActivityBeVisible(in IBinder token)70 boolean willActivityBeVisible(in IBinder token); getDisplayId(in IBinder activityToken)71 int getDisplayId(in IBinder activityToken); getTaskForActivity(in IBinder token, in boolean onlyRoot)72 int getTaskForActivity(in IBinder token, in boolean onlyRoot); getActivityTokenBelow(IBinder token)73 IBinder getActivityTokenBelow(IBinder token); getCallingActivity(in IBinder token)74 ComponentName getCallingActivity(in IBinder token); getCallingPackage(in IBinder token)75 String getCallingPackage(in IBinder token); getLaunchedFromUid(in IBinder token)76 int getLaunchedFromUid(in IBinder token); getLaunchedFromPackage(in IBinder token)77 String getLaunchedFromPackage(in IBinder token); 78 setRequestedOrientation(in IBinder token, int requestedOrientation)79 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)80 int getRequestedOrientation(in IBinder token); 81 convertFromTranslucent(in IBinder token)82 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)83 boolean convertToTranslucent(in IBinder token, in Bundle options); 84 isImmersive(in IBinder token)85 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)86 void setImmersive(in IBinder token, boolean immersive); 87 enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)88 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)89 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); toggleFreeformWindowingMode(in IBinder token)90 void toggleFreeformWindowingMode(in IBinder token); 91 startLockTaskModeByToken(in IBinder token)92 oneway void startLockTaskModeByToken(in IBinder token); stopLockTaskModeByToken(in IBinder token)93 oneway void stopLockTaskModeByToken(in IBinder token); showLockTaskEscapeMessage(in IBinder token)94 oneway void showLockTaskEscapeMessage(in IBinder token); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)95 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 96 showAssistFromActivity(in IBinder token, in Bundle args)97 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)98 boolean isRootVoiceInteraction(in IBinder token); startLocalVoiceInteraction(in IBinder token, in Bundle options)99 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)100 void stopLocalVoiceInteraction(in IBinder token); 101 setShowWhenLocked(in IBinder token, boolean showWhenLocked)102 oneway void setShowWhenLocked(in IBinder token, boolean showWhenLocked); setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)103 oneway void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked); setTurnScreenOn(in IBinder token, boolean turnScreenOn)104 oneway void setTurnScreenOn(in IBinder token, boolean turnScreenOn); reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)105 oneway void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle); 106 /** 107 * Overrides the animation of activity pending transition. This call is not one-way because 108 * the method is usually used after startActivity or Activity#finish. If this is non-blocking, 109 * the calling activity may proceed to complete pause and become stopping state, which will 110 * cause the request to be ignored. Besides, startActivity and Activity#finish are blocking 111 * calls, so this method should be the same as them to keep the invocation order. 112 */ overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim)113 void overridePendingTransition(in IBinder token, in String packageName, 114 int enterAnim, int exitAnim); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)115 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 116 117 /** See {@link android.app.Activity#setDisablePreviewScreenshots}. */ setDisablePreviewScreenshots(in IBinder token, boolean disable)118 oneway void setDisablePreviewScreenshots(in IBinder token, boolean disable); 119 120 /** 121 * It should only be called from home activity to remove its outdated snapshot. The home 122 * snapshot is used to speed up entering home from screen off. If the content of home activity 123 * is significantly different from before taking the snapshot, then the home activity can use 124 * this method to avoid inconsistent transition. 125 */ invalidateHomeTaskSnapshot(IBinder homeToken)126 void invalidateHomeTaskSnapshot(IBinder homeToken); 127 dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)128 void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, 129 in CharSequence message); 130 131 /** Registers remote animations for a specific activity. */ registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)132 void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition); 133 134 /** Unregisters all remote animations for a specific activity. */ unregisterRemoteAnimations(in IBinder token)135 void unregisterRemoteAnimations(in IBinder token); 136 137 /** 138 * Reports that an Activity received a back key press when there were no additional activities 139 * on the back stack. 140 */ onBackPressedOnTaskRoot(in IBinder activityToken, in IRequestFinishCallback callback)141 oneway void onBackPressedOnTaskRoot(in IBinder activityToken, 142 in IRequestFinishCallback callback); 143 144 /** Reports that the splash screen view has attached to activity. */ splashScreenAttached(in IBinder token)145 oneway void splashScreenAttached(in IBinder token); 146 } 147