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); getCallingActivity(in IBinder token)73 ComponentName getCallingActivity(in IBinder token); getCallingPackage(in IBinder token)74 String getCallingPackage(in IBinder token); getLaunchedFromUid(in IBinder token)75 int getLaunchedFromUid(in IBinder token); getLaunchedFromPackage(in IBinder token)76 String getLaunchedFromPackage(in IBinder token); 77 setRequestedOrientation(in IBinder token, int requestedOrientation)78 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)79 int getRequestedOrientation(in IBinder token); 80 convertFromTranslucent(in IBinder token)81 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)82 boolean convertToTranslucent(in IBinder token, in Bundle options); 83 isImmersive(in IBinder token)84 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)85 void setImmersive(in IBinder token, boolean immersive); 86 enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)87 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)88 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); toggleFreeformWindowingMode(in IBinder token)89 void toggleFreeformWindowingMode(in IBinder token); 90 startLockTaskModeByToken(in IBinder token)91 oneway void startLockTaskModeByToken(in IBinder token); stopLockTaskModeByToken(in IBinder token)92 oneway void stopLockTaskModeByToken(in IBinder token); showLockTaskEscapeMessage(in IBinder token)93 oneway void showLockTaskEscapeMessage(in IBinder token); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)94 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 95 showAssistFromActivity(in IBinder token, in Bundle args)96 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)97 boolean isRootVoiceInteraction(in IBinder token); startLocalVoiceInteraction(in IBinder token, in Bundle options)98 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)99 void stopLocalVoiceInteraction(in IBinder token); 100 setShowWhenLocked(in IBinder token, boolean showWhenLocked)101 oneway void setShowWhenLocked(in IBinder token, boolean showWhenLocked); setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)102 oneway void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked); setTurnScreenOn(in IBinder token, boolean turnScreenOn)103 oneway void setTurnScreenOn(in IBinder token, boolean turnScreenOn); reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)104 oneway void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle); 105 /** 106 * Overrides the animation of activity pending transition. This call is not one-way because 107 * the method is usually used after startActivity or Activity#finish. If this is non-blocking, 108 * the calling activity may proceed to complete pause and become stopping state, which will 109 * cause the request to be ignored. Besides, startActivity and Activity#finish are blocking 110 * calls, so this method should be the same as them to keep the invocation order. 111 */ overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim)112 void overridePendingTransition(in IBinder token, in String packageName, 113 int enterAnim, int exitAnim); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)114 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 115 116 /** See {@link android.app.Activity#setDisablePreviewScreenshots}. */ setDisablePreviewScreenshots(in IBinder token, boolean disable)117 oneway void setDisablePreviewScreenshots(in IBinder token, boolean disable); 118 119 /** 120 * It should only be called from home activity to remove its outdated snapshot. The home 121 * snapshot is used to speed up entering home from screen off. If the content of home activity 122 * is significantly different from before taking the snapshot, then the home activity can use 123 * this method to avoid inconsistent transition. 124 */ invalidateHomeTaskSnapshot(IBinder homeToken)125 void invalidateHomeTaskSnapshot(IBinder homeToken); 126 dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)127 void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, 128 in CharSequence message); 129 130 /** Registers remote animations for a specific activity. */ registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)131 void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition); 132 133 /** Unregisters all remote animations for a specific activity. */ unregisterRemoteAnimations(in IBinder token)134 void unregisterRemoteAnimations(in IBinder token); 135 136 /** 137 * Reports that an Activity received a back key press when there were no additional activities 138 * on the back stack. 139 */ onBackPressedOnTaskRoot(in IBinder activityToken, in IRequestFinishCallback callback)140 oneway void onBackPressedOnTaskRoot(in IBinder activityToken, 141 in IRequestFinishCallback callback); 142 143 /** Reports that the splash screen view has attached to activity. */ splashScreenAttached(in IBinder token)144 oneway void splashScreenAttached(in IBinder token); 145 } 146