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.ICompatCameraControlCallback; 21 import android.app.IRequestFinishCallback; 22 import android.app.PictureInPictureParams; 23 import android.content.ComponentName; 24 import android.content.Intent; 25 import android.content.res.Configuration; 26 import android.os.Bundle; 27 import android.os.IRemoteCallback; 28 import android.os.PersistableBundle; 29 import android.view.RemoteAnimationDefinition; 30 import android.window.SizeConfigurationBuckets; 31 32 import com.android.internal.policy.IKeyguardDismissCallback; 33 34 /** 35 * Interface for the callback and request from an activity to system. 36 * 37 * {@hide} 38 */ 39 interface IActivityClientController { activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling)40 oneway void activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling); activityResumed(in IBinder token, in boolean handleSplashScreenExit)41 oneway void activityResumed(in IBinder token, in boolean handleSplashScreenExit); activityRefreshed(in IBinder token)42 oneway void activityRefreshed(in IBinder token); 43 /** 44 * This call is not one-way because {@link #activityPaused()) is not one-way, or 45 * the top-resumed-lost could be reported after activity paused. 46 */ activityTopResumedStateLost()47 void activityTopResumedStateLost(); 48 /** 49 * Notifies that the activity has completed paused. This call is not one-way because it can make 50 * consecutive launch in the same process more coherent. About the order of binder call, it 51 * should be fine with other one-way calls because if pause hasn't completed on the server side, 52 * there won't be other lifecycle changes. 53 */ activityPaused(in IBinder token)54 void activityPaused(in IBinder token); activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description)55 oneway void activityStopped(in IBinder token, in Bundle state, 56 in PersistableBundle persistentState, in CharSequence description); activityDestroyed(in IBinder token)57 oneway void activityDestroyed(in IBinder token); activityLocalRelaunch(in IBinder token)58 oneway void activityLocalRelaunch(in IBinder token); activityRelaunched(in IBinder token)59 oneway void activityRelaunched(in IBinder token); 60 reportSizeConfigurations(in IBinder token, in SizeConfigurationBuckets sizeConfigurations)61 oneway void reportSizeConfigurations(in IBinder token, 62 in SizeConfigurationBuckets sizeConfigurations); moveActivityTaskToBack(in IBinder token, boolean nonRoot)63 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot); shouldUpRecreateTask(in IBinder token, in String destAffinity)64 boolean shouldUpRecreateTask(in IBinder token, in String destAffinity); navigateUpTo(in IBinder token, in Intent target, in String resolvedType, int resultCode, in Intent resultData)65 boolean navigateUpTo(in IBinder token, in Intent target, in String resolvedType, 66 int resultCode, in Intent resultData); releaseActivityInstance(in IBinder token)67 boolean releaseActivityInstance(in IBinder token); finishActivity(in IBinder token, int code, in Intent data, int finishTask)68 boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); finishActivityAffinity(in IBinder token)69 boolean finishActivityAffinity(in IBinder token); 70 /** Finish all activities that were started for result from the specified activity. */ finishSubActivity(in IBinder token, in String resultWho, int requestCode)71 void finishSubActivity(in IBinder token, in String resultWho, int requestCode); 72 /** 73 * Indicates that when the activity finsihes, the result should be immediately sent to the 74 * originating activity. Must only be invoked during MediaProjection setup. 75 */ 76 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MANAGE_MEDIA_PROJECTION)") setForceSendResultForMediaProjection(in IBinder token)77 void setForceSendResultForMediaProjection(in IBinder token); 78 isTopOfTask(in IBinder token)79 boolean isTopOfTask(in IBinder token); willActivityBeVisible(in IBinder token)80 boolean willActivityBeVisible(in IBinder token); getDisplayId(in IBinder activityToken)81 int getDisplayId(in IBinder activityToken); getTaskForActivity(in IBinder token, in boolean onlyRoot)82 int getTaskForActivity(in IBinder token, in boolean onlyRoot); 83 /** 84 * Returns the {@link Configuration} of the task which hosts the Activity, or {@code null} if 85 * the task {@link Configuration} cannot be obtained. 86 */ getTaskConfiguration(in IBinder activityToken)87 Configuration getTaskConfiguration(in IBinder activityToken); getActivityTokenBelow(IBinder token)88 IBinder getActivityTokenBelow(IBinder token); getCallingActivity(in IBinder token)89 ComponentName getCallingActivity(in IBinder token); getCallingPackage(in IBinder token)90 String getCallingPackage(in IBinder token); getLaunchedFromUid(in IBinder token)91 int getLaunchedFromUid(in IBinder token); getLaunchedFromPackage(in IBinder token)92 String getLaunchedFromPackage(in IBinder token); 93 setRequestedOrientation(in IBinder token, int requestedOrientation)94 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)95 int getRequestedOrientation(in IBinder token); 96 convertFromTranslucent(in IBinder token)97 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)98 boolean convertToTranslucent(in IBinder token, in Bundle options); 99 isImmersive(in IBinder token)100 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)101 void setImmersive(in IBinder token, boolean immersive); 102 enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)103 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)104 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays)105 oneway void setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays); toggleFreeformWindowingMode(in IBinder token)106 void toggleFreeformWindowingMode(in IBinder token); requestMultiwindowFullscreen(in IBinder token, in int request, in IRemoteCallback callback)107 oneway void requestMultiwindowFullscreen(in IBinder token, in int request, 108 in IRemoteCallback callback); 109 startLockTaskModeByToken(in IBinder token)110 oneway void startLockTaskModeByToken(in IBinder token); stopLockTaskModeByToken(in IBinder token)111 oneway void stopLockTaskModeByToken(in IBinder token); showLockTaskEscapeMessage(in IBinder token)112 oneway void showLockTaskEscapeMessage(in IBinder token); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)113 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 114 showAssistFromActivity(in IBinder token, in Bundle args)115 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)116 boolean isRootVoiceInteraction(in IBinder token); startLocalVoiceInteraction(in IBinder token, in Bundle options)117 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)118 void stopLocalVoiceInteraction(in IBinder token); 119 setShowWhenLocked(in IBinder token, boolean showWhenLocked)120 oneway void setShowWhenLocked(in IBinder token, boolean showWhenLocked); setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)121 oneway void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked); setTurnScreenOn(in IBinder token, boolean turnScreenOn)122 oneway void setTurnScreenOn(in IBinder token, boolean turnScreenOn); setAllowCrossUidActivitySwitchFromBelow(in IBinder token, boolean allowed)123 oneway void setAllowCrossUidActivitySwitchFromBelow(in IBinder token, boolean allowed); reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)124 oneway void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle); overrideActivityTransition(IBinder token, boolean open, int enterAnim, int exitAnim, int backgroundColor)125 oneway void overrideActivityTransition(IBinder token, boolean open, int enterAnim, int exitAnim, 126 int backgroundColor); clearOverrideActivityTransition(IBinder token, boolean open)127 oneway void clearOverrideActivityTransition(IBinder token, boolean open); 128 /** 129 * Overrides the animation of activity pending transition. This call is not one-way because 130 * the method is usually used after startActivity or Activity#finish. If this is non-blocking, 131 * the calling activity may proceed to complete pause and become stopping state, which will 132 * cause the request to be ignored. Besides, startActivity and Activity#finish are blocking 133 * calls, so this method should be the same as them to keep the invocation order. 134 */ overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim, int backgroundColor)135 void overridePendingTransition(in IBinder token, in String packageName, 136 int enterAnim, int exitAnim, int backgroundColor); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)137 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 138 139 /** See {@link android.app.Activity#setRecentsScreenshotEnabled}. */ setRecentsScreenshotEnabled(in IBinder token, boolean enabled)140 oneway void setRecentsScreenshotEnabled(in IBinder token, boolean enabled); 141 142 /** 143 * It should only be called from home activity to remove its outdated snapshot. The home 144 * snapshot is used to speed up entering home from screen off. If the content of home activity 145 * is significantly different from before taking the snapshot, then the home activity can use 146 * this method to avoid inconsistent transition. 147 */ invalidateHomeTaskSnapshot(IBinder homeToken)148 void invalidateHomeTaskSnapshot(IBinder homeToken); 149 dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)150 void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, 151 in CharSequence message); 152 153 /** Registers remote animations for a specific activity. */ registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)154 void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition); 155 156 /** Unregisters all remote animations for a specific activity. */ unregisterRemoteAnimations(in IBinder token)157 void unregisterRemoteAnimations(in IBinder token); 158 159 /** 160 * Reports that an Activity received a back key press. 161 */ onBackPressed(in IBinder activityToken, in IRequestFinishCallback callback)162 oneway void onBackPressed(in IBinder activityToken, 163 in IRequestFinishCallback callback); 164 165 /** Reports that the splash screen view has attached to activity. */ splashScreenAttached(in IBinder token)166 oneway void splashScreenAttached(in IBinder token); 167 168 /** 169 * Shows or hides a Camera app compat toggle for stretched issues with the requested state. 170 * 171 * @param token The token for the window that needs a control. 172 * @param showControl Whether the control should be shown or hidden. 173 * @param transformationApplied Whether the treatment is already applied. 174 * @param callback The callback executed when the user clicks on a control. 175 */ requestCompatCameraControl(in IBinder token, boolean showControl, boolean transformationApplied, in ICompatCameraControlCallback callback)176 oneway void requestCompatCameraControl(in IBinder token, boolean showControl, 177 boolean transformationApplied, in ICompatCameraControlCallback callback); 178 179 /** 180 * If set, any activity launch in the same task will be overridden to the locale of activity 181 * that started the task. 182 */ enableTaskLocaleOverride(in IBinder token)183 void enableTaskLocaleOverride(in IBinder token); 184 185 /** 186 * Return {@code true} if the activity was explicitly requested to be launched in the 187 * TaskFragment. 188 * 189 * @param activityToken The token of the Activity. 190 * @param taskFragmentToken The token of the TaskFragment. 191 */ isRequestedToLaunchInTaskFragment(in IBinder activityToken, in IBinder taskFragmentToken)192 boolean isRequestedToLaunchInTaskFragment(in IBinder activityToken, 193 in IBinder taskFragmentToken); 194 } 195