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.net.Uri; 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); getActivityCallerUid(in IBinder activityToken, in IBinder callerToken)92 int getActivityCallerUid(in IBinder activityToken, in IBinder callerToken); getLaunchedFromPackage(in IBinder token)93 String getLaunchedFromPackage(in IBinder token); getActivityCallerPackage(in IBinder activityToken, in IBinder callerToken)94 String getActivityCallerPackage(in IBinder activityToken, in IBinder callerToken); 95 checkActivityCallerContentUriPermission(in IBinder activityToken, in IBinder callerToken, in Uri uri, int modeFlags, int userId)96 int checkActivityCallerContentUriPermission(in IBinder activityToken, in IBinder callerToken, 97 in Uri uri, int modeFlags, int userId); 98 setRequestedOrientation(in IBinder token, int requestedOrientation)99 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)100 int getRequestedOrientation(in IBinder token); 101 convertFromTranslucent(in IBinder token)102 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)103 boolean convertToTranslucent(in IBinder token, in Bundle options); 104 isImmersive(in IBinder token)105 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)106 void setImmersive(in IBinder token, boolean immersive); 107 enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)108 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)109 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays)110 oneway void setShouldDockBigOverlays(in IBinder token, in boolean shouldDockBigOverlays); toggleFreeformWindowingMode(in IBinder token)111 void toggleFreeformWindowingMode(in IBinder token); requestMultiwindowFullscreen(in IBinder token, in int request, in IRemoteCallback callback)112 oneway void requestMultiwindowFullscreen(in IBinder token, in int request, 113 in IRemoteCallback callback); 114 startLockTaskModeByToken(in IBinder token)115 void startLockTaskModeByToken(in IBinder token); stopLockTaskModeByToken(in IBinder token)116 void stopLockTaskModeByToken(in IBinder token); showLockTaskEscapeMessage(in IBinder token)117 oneway void showLockTaskEscapeMessage(in IBinder token); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)118 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 119 showAssistFromActivity(in IBinder token, in Bundle args)120 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)121 boolean isRootVoiceInteraction(in IBinder token); startLocalVoiceInteraction(in IBinder token, in Bundle options)122 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)123 void stopLocalVoiceInteraction(in IBinder token); 124 setShowWhenLocked(in IBinder token, boolean showWhenLocked)125 oneway void setShowWhenLocked(in IBinder token, boolean showWhenLocked); setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)126 oneway void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked); setTurnScreenOn(in IBinder token, boolean turnScreenOn)127 void setTurnScreenOn(in IBinder token, boolean turnScreenOn); setAllowCrossUidActivitySwitchFromBelow(in IBinder token, boolean allowed)128 oneway void setAllowCrossUidActivitySwitchFromBelow(in IBinder token, boolean allowed); reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)129 oneway void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle); overrideActivityTransition(IBinder token, boolean open, int enterAnim, int exitAnim, int backgroundColor)130 oneway void overrideActivityTransition(IBinder token, boolean open, int enterAnim, int exitAnim, 131 int backgroundColor); clearOverrideActivityTransition(IBinder token, boolean open)132 oneway void clearOverrideActivityTransition(IBinder token, boolean open); 133 /** 134 * Overrides the animation of activity pending transition. This call is not one-way because 135 * the method is usually used after startActivity or Activity#finish. If this is non-blocking, 136 * the calling activity may proceed to complete pause and become stopping state, which will 137 * cause the request to be ignored. Besides, startActivity and Activity#finish are blocking 138 * calls, so this method should be the same as them to keep the invocation order. 139 */ overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim, int backgroundColor)140 void overridePendingTransition(in IBinder token, in String packageName, 141 int enterAnim, int exitAnim, int backgroundColor); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)142 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 143 144 /** See {@link android.app.Activity#setRecentsScreenshotEnabled}. */ setRecentsScreenshotEnabled(in IBinder token, boolean enabled)145 oneway void setRecentsScreenshotEnabled(in IBinder token, boolean enabled); 146 147 /** 148 * It should only be called from home activity to remove its outdated snapshot. The home 149 * snapshot is used to speed up entering home from screen off. If the content of home activity 150 * is significantly different from before taking the snapshot, then the home activity can use 151 * this method to avoid inconsistent transition. 152 */ invalidateHomeTaskSnapshot(IBinder homeToken)153 void invalidateHomeTaskSnapshot(IBinder homeToken); 154 dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)155 void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, 156 in CharSequence message); 157 158 /** Registers remote animations for a specific activity. */ registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)159 void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition); 160 161 /** Unregisters all remote animations for a specific activity. */ unregisterRemoteAnimations(in IBinder token)162 void unregisterRemoteAnimations(in IBinder token); 163 164 /** 165 * Reports that an Activity received a back key press. 166 */ onBackPressed(in IBinder activityToken, in IRequestFinishCallback callback)167 oneway void onBackPressed(in IBinder activityToken, 168 in IRequestFinishCallback callback); 169 170 /** Reports that the splash screen view has attached to activity. */ splashScreenAttached(in IBinder token)171 oneway void splashScreenAttached(in IBinder token); 172 173 /** 174 * If set, any activity launch in the same task will be overridden to the locale of activity 175 * that started the task. 176 */ enableTaskLocaleOverride(in IBinder token)177 void enableTaskLocaleOverride(in IBinder token); 178 179 /** 180 * Return {@code true} if the activity was explicitly requested to be launched in the 181 * TaskFragment. 182 * 183 * @param activityToken The token of the Activity. 184 * @param taskFragmentToken The token of the TaskFragment. 185 */ isRequestedToLaunchInTaskFragment(in IBinder activityToken, in IBinder taskFragmentToken)186 boolean isRequestedToLaunchInTaskFragment(in IBinder activityToken, 187 in IBinder taskFragmentToken); 188 189 /** 190 * Enable or disable ActivityRecordInputSink to block input events. 191 * 192 * @param token The token for the activity that requests to toggle. 193 * @param enabled Whether the input evens are blocked by ActivityRecordInputSink. 194 */ 195 @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest" 196 + ".permission.INTERNAL_SYSTEM_WINDOW)") setActivityRecordInputSinkEnabled(in IBinder activityToken, boolean enabled)197 oneway void setActivityRecordInputSinkEnabled(in IBinder activityToken, boolean enabled); 198 } 199