Loading core/java/android/app/ActivityThread.java +1 −121 Original line number Original line Diff line number Diff line Loading @@ -254,8 +254,8 @@ import com.android.internal.util.FastPrintWriter; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.util.function.pooled.PooledLambda; import com.android.internal.util.function.pooled.PooledLambda; import com.android.org.conscrypt.TrustedCertificateStore; import com.android.org.conscrypt.TrustedCertificateStore; import com.android.server.am.BitmapDumpProto; import com.android.server.am.MemInfoDumpProto; import com.android.server.am.MemInfoDumpProto; import com.android.server.am.BitmapDumpProto; import dalvik.annotation.optimization.NeverCompile; import dalvik.annotation.optimization.NeverCompile; import dalvik.system.AppSpecializationHooks; import dalvik.system.AppSpecializationHooks; Loading Loading @@ -298,7 +298,6 @@ import java.util.TimeZone; import java.util.concurrent.Executor; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.function.Consumer; import java.util.stream.Collectors; /** /** * This manages the execution of the main thread in an * This manages the execution of the main thread in an Loading Loading @@ -1149,12 +1148,10 @@ public final class ActivityThread extends ClientTransactionHandler private static final String DB_POOL_INFO_HEADER = " %13s %13s %13s %s"; private static final String DB_POOL_INFO_HEADER = " %13s %13s %13s %s"; private static final String DB_POOL_INFO_FORMAT = " %13d %13d %13d %s"; private static final String DB_POOL_INFO_FORMAT = " %13d %13d %13d %s"; @Override public final void scheduleReceiver(Intent intent, ActivityInfo info, public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) { int sendingUid, String sendingPackage) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, Loading @@ -1166,9 +1163,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.RECEIVER, r); sendMessage(H.RECEIVER, r); } } @Override public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { assertCalledBySystem(); for (int i = 0; i < info.size(); i++) { for (int i = 0; i < info.size(); i++) { ReceiverInfo r = info.get(i); ReceiverInfo r = info.get(i); if (r.registered) { if (r.registered) { Loading @@ -1185,10 +1180,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void scheduleCreateBackupAgent(ApplicationInfo app, public final void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode, int userId, @BackupDestination int backupDestination) { int backupMode, int userId, @BackupDestination int backupDestination) { assertCalledBySystem(); CreateBackupAgentData d = new CreateBackupAgentData(); CreateBackupAgentData d = new CreateBackupAgentData(); d.appInfo = app; d.appInfo = app; d.backupMode = backupMode; d.backupMode = backupMode; Loading @@ -1198,9 +1191,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.CREATE_BACKUP_AGENT, d); sendMessage(H.CREATE_BACKUP_AGENT, d); } } @Override public final void scheduleDestroyBackupAgent(ApplicationInfo app, int userId) { public final void scheduleDestroyBackupAgent(ApplicationInfo app, int userId) { assertCalledBySystem(); CreateBackupAgentData d = new CreateBackupAgentData(); CreateBackupAgentData d = new CreateBackupAgentData(); d.appInfo = app; d.appInfo = app; d.userId = userId; d.userId = userId; Loading @@ -1208,10 +1199,8 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.DESTROY_BACKUP_AGENT, d); sendMessage(H.DESTROY_BACKUP_AGENT, d); } } @Override public final void scheduleCreateService(IBinder token, public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState) { ServiceInfo info, CompatibilityInfo compatInfo, int processState) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); CreateServiceData s = new CreateServiceData(); CreateServiceData s = new CreateServiceData(); s.token = token; s.token = token; Loading @@ -1227,10 +1216,8 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.CREATE_SERVICE, s); sendMessage(H.CREATE_SERVICE, s); } } @Override public final void scheduleBindService(IBinder token, IBinder bindToken, Intent intent, public final void scheduleBindService(IBinder token, IBinder bindToken, Intent intent, boolean rebind, int processState, long bindSeq) { boolean rebind, int processState, long bindSeq) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); BindServiceData s = new BindServiceData(); BindServiceData s = new BindServiceData(); s.token = token; s.token = token; Loading @@ -1254,9 +1241,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.BIND_SERVICE, s); sendMessage(H.BIND_SERVICE, s); } } @Override public final void scheduleUnbindService(IBinder token, IBinder bindToken, Intent intent) { public final void scheduleUnbindService(IBinder token, IBinder bindToken, Intent intent) { assertCalledBySystem(); BindServiceData s = new BindServiceData(); BindServiceData s = new BindServiceData(); s.token = token; s.token = token; s.bindToken = bindToken; s.bindToken = bindToken; Loading @@ -1270,9 +1255,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.UNBIND_SERVICE, s); sendMessage(H.UNBIND_SERVICE, s); } } @Override public final void scheduleServiceArgs(IBinder token, ParceledListSlice args) { public final void scheduleServiceArgs(IBinder token, ParceledListSlice args) { assertCalledBySystem(); List<ServiceStartArgs> list = args.getList(); List<ServiceStartArgs> list = args.getList(); for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) { Loading @@ -1295,9 +1278,7 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void scheduleStopService(IBinder token) { public final void scheduleStopService(IBinder token) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleStopService. token=" Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleStopService. token=" + token); + token); Loading @@ -1307,7 +1288,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public final void scheduleTimeoutService(IBinder token, int startId) { public final void scheduleTimeoutService(IBinder token, int startId) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutService. token=" Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutService. token=" + token); + token); Loading @@ -1317,14 +1297,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public final void schedulePing(RemoteCallback pong) { public final void schedulePing(RemoteCallback pong) { assertCalledBySystem(); sendMessage(H.PING, pong); sendMessage(H.PING, pong); } } @Override @Override public final void scheduleTimeoutServiceForType(IBinder token, int startId, public final void scheduleTimeoutServiceForType(IBinder token, int startId, @ServiceInfo.ForegroundServiceType int fgsType) { @ServiceInfo.ForegroundServiceType int fgsType) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutServiceForType. token=" + token); "scheduleTimeoutServiceForType. token=" + token); Loading Loading @@ -1363,7 +1341,6 @@ public final class ActivityThread extends ClientTransactionHandler FileDescriptor applicationSharedMemoryFd, FileDescriptor applicationSharedMemoryFd, long startRequestedElapsedTime, long startRequestedElapsedTime, long startRequestedUptime) { long startRequestedUptime) { assertCalledBySystem(); if (DEBUG_STORE_ENABLED) { if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBindApplication(); DebugStore.recordScheduleBindApplication(); } } Loading Loading @@ -1459,30 +1436,22 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void runIsolatedEntryPoint(String entryPoint, String[] entryPointArgs) { public final void runIsolatedEntryPoint(String entryPoint, String[] entryPointArgs) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = entryPoint; args.arg1 = entryPoint; args.arg2 = entryPointArgs; args.arg2 = entryPointArgs; sendMessage(H.RUN_ISOLATED_ENTRY_POINT, args); sendMessage(H.RUN_ISOLATED_ENTRY_POINT, args); } } @Override public final void scheduleExit() { public final void scheduleExit() { assertCalledBySystem(); sendMessage(H.EXIT_APPLICATION, null); sendMessage(H.EXIT_APPLICATION, null); } } @Override public final void scheduleSuicide() { public final void scheduleSuicide() { assertCalledBySystem(); sendMessage(H.SUICIDE, null); sendMessage(H.SUICIDE, null); } } @Override public void scheduleApplicationInfoChanged(ApplicationInfo ai) { public void scheduleApplicationInfoChanged(ApplicationInfo ai) { assertCalledBySystem(); synchronized (mResourcesManager) { synchronized (mResourcesManager) { var oldAi = mPendingAppInfoUpdates.put(ai.packageName, ai); var oldAi = mPendingAppInfoUpdates.put(ai.packageName, ai); if (oldAi != null && oldAi.createTimestamp > ai.createTimestamp) { if (oldAi != null && oldAi.createTimestamp > ai.createTimestamp) { Loading @@ -1498,15 +1467,11 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.APPLICATION_INFO_CHANGED, ai.packageName); sendMessage(H.APPLICATION_INFO_CHANGED, ai.packageName); } } @Override public void updateTimeZone() { public void updateTimeZone() { assertCalledBySystem(); TimeZone.setDefault(null); TimeZone.setDefault(null); } } @Override public void clearDnsCache() { public void clearDnsCache() { assertCalledBySystem(); // a non-standard API to get this to libcore // a non-standard API to get this to libcore InetAddress.clearDnsCache(); InetAddress.clearDnsCache(); // Allow libcore to perform the necessary actions as it sees fit upon a network // Allow libcore to perform the necessary actions as it sees fit upon a network Loading @@ -1514,9 +1479,7 @@ public final class ActivityThread extends ClientTransactionHandler NetworkEventDispatcher.getInstance().dispatchNetworkConfigurationChange(); NetworkEventDispatcher.getInstance().dispatchNetworkConfigurationChange(); } } @Override public void updateHttpProxy() { public void updateHttpProxy() { assertCalledBySystem(); final Application app; final Application app; synchronized (ActivityThread.this) { synchronized (ActivityThread.this) { app = getApplication(); app = getApplication(); Loading @@ -1531,16 +1494,12 @@ public final class ActivityThread extends ClientTransactionHandler ActivityThread.updateHttpProxy(app); ActivityThread.updateHttpProxy(app); } } @Override public void processInBackground() { public void processInBackground() { assertCalledBySystem(); mH.removeMessages(H.GC_WHEN_IDLE); mH.removeMessages(H.GC_WHEN_IDLE); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); } } @Override public void dumpService(ParcelFileDescriptor pfd, IBinder servicetoken, String[] args) { public void dumpService(ParcelFileDescriptor pfd, IBinder servicetoken, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1557,13 +1516,11 @@ public final class ActivityThread extends ClientTransactionHandler // This function exists to make sure all receiver dispatching is // This function exists to make sure all receiver dispatching is // correctly ordered, since these are one-way calls and the binder driver // correctly ordered, since these are one-way calls and the binder driver // applies transaction ordering per object for such calls. // applies transaction ordering per object for such calls. @Override public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, boolean assumeDelivered, int sendingUser, int processState, boolean sticky, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) int sendingUid, String sendingPackage) throws RemoteException { throws RemoteException { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); // We can't modify IIntentReceiver due to UnsupportedAppUsage, so // We can't modify IIntentReceiver due to UnsupportedAppUsage, so Loading Loading @@ -1592,20 +1549,17 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleLowMemory() { public void scheduleLowMemory() { assertCalledBySystem(); sendMessage(H.LOW_MEMORY, null); sendMessage(H.LOW_MEMORY, null); } } @Override @Override public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType) { public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType) { assertCalledBySystem(); sendMessage(H.PROFILER_CONTROL, profilerInfo, start ? 1 : 0, profileType); sendMessage(H.PROFILER_CONTROL, profilerInfo, start ? 1 : 0, profileType); } } @Override @Override public void dumpHeap(boolean managed, boolean mallocInfo, boolean runGc, String dumpBitmaps, public void dumpHeap(boolean managed, boolean mallocInfo, boolean runGc, String dumpBitmaps, String path, ParcelFileDescriptor fd, RemoteCallback finishCallback) { String path, ParcelFileDescriptor fd, RemoteCallback finishCallback) { assertCalledBySystem(); DumpHeapData dhd = new DumpHeapData(); DumpHeapData dhd = new DumpHeapData(); dhd.managed = managed; dhd.managed = managed; dhd.mallocInfo = mallocInfo; dhd.mallocInfo = mallocInfo; Loading @@ -1626,21 +1580,15 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.DUMP_HEAP, dhd, 0, 0, true /*async*/); sendMessage(H.DUMP_HEAP, dhd, 0, 0, true /*async*/); } } @Override public void attachAgent(String agent) { public void attachAgent(String agent) { assertCalledBySystem(); sendMessage(H.ATTACH_AGENT, agent); sendMessage(H.ATTACH_AGENT, agent); } } @Override public void attachStartupAgents(String dataDir) { public void attachStartupAgents(String dataDir) { assertCalledBySystem(); sendMessage(H.ATTACH_STARTUP_AGENTS, dataDir); sendMessage(H.ATTACH_STARTUP_AGENTS, dataDir); } } @Override public void setSchedulingGroup(int group) { public void setSchedulingGroup(int group) { assertCalledBySystem(); // Note: do this immediately, since going into the foreground // Note: do this immediately, since going into the foreground // should happen regardless of what pending work we have to do // should happen regardless of what pending work we have to do // and the activity manager will wait for us to report back that // and the activity manager will wait for us to report back that Loading @@ -1652,15 +1600,12 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dispatchPackageBroadcast(int cmd, String[] packages) { public void dispatchPackageBroadcast(int cmd, String[] packages) { assertCalledBySystem(); sendMessage(H.DISPATCH_PACKAGE_BROADCAST, packages, cmd); sendMessage(H.DISPATCH_PACKAGE_BROADCAST, packages, cmd); } } @Override @Override public void scheduleCrash(String msg, int typeId, @Nullable Bundle extras) { public void scheduleCrash(String msg, int typeId, @Nullable Bundle extras) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = msg; args.arg1 = msg; args.arg2 = extras; args.arg2 = extras; Loading @@ -1669,7 +1614,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpResources(ParcelFileDescriptor fd, RemoteCallback callback) { public void dumpResources(ParcelFileDescriptor fd, RemoteCallback callback) { assertCalledBySystem(); DumpResourcesData data = new DumpResourcesData(); DumpResourcesData data = new DumpResourcesData(); try { try { data.fd = fd.dup(); data.fd = fd.dup(); Loading @@ -1682,10 +1626,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dumpActivity(ParcelFileDescriptor pfd, IBinder activitytoken, public void dumpActivity(ParcelFileDescriptor pfd, IBinder activitytoken, String prefix, String[] args) { String prefix, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1700,10 +1642,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dumpProvider(ParcelFileDescriptor pfd, IBinder providertoken, public void dumpProvider(ParcelFileDescriptor pfd, IBinder providertoken, String[] args) { String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1722,7 +1662,6 @@ public final class ActivityThread extends ClientTransactionHandler public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { assertCalledBySystem(); FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); PrintWriter pw = new FastPrintWriter(fout); PrintWriter pw = new FastPrintWriter(fout); try { try { Loading Loading @@ -1930,7 +1869,6 @@ public final class ActivityThread extends ClientTransactionHandler public void dumpMemInfoProto(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, public void dumpMemInfoProto(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, String[] args) { boolean dumpUnreachable, String[] args) { assertCalledBySystem(); ProtoOutputStream proto = new ProtoOutputStream(pfd.getFileDescriptor()); ProtoOutputStream proto = new ProtoOutputStream(pfd.getFileDescriptor()); try { try { dumpMemInfo(proto, mem, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); dumpMemInfo(proto, mem, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); Loading Loading @@ -2058,7 +1996,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpGfxInfo(ParcelFileDescriptor pfd, String[] args) { public void dumpGfxInfo(ParcelFileDescriptor pfd, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -2075,7 +2012,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override @NeverCompile @NeverCompile public void dumpBitmapsProto(ParcelFileDescriptor pfd, String dumpFormat) { public void dumpBitmapsProto(ParcelFileDescriptor pfd, String dumpFormat) { assertCalledBySystem(); try { try { int pid = Process.myPid(); int pid = Process.myPid(); String processName = (mBoundApplication != null) String processName = (mBoundApplication != null) Loading @@ -2090,7 +2026,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpCacheInfo(ParcelFileDescriptor pfd, String[] args) { public void dumpCacheInfo(ParcelFileDescriptor pfd, String[] args) { assertCalledBySystem(); try { try { PropertyInvalidatedCache.dumpCacheInfo(pfd, args); PropertyInvalidatedCache.dumpCacheInfo(pfd, args); BroadcastStickyCache.dumpCacheInfo(pfd); BroadcastStickyCache.dumpCacheInfo(pfd); Loading @@ -2114,7 +2049,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpDbInfo(final ParcelFileDescriptor pfd, final String[] args) { public void dumpDbInfo(final ParcelFileDescriptor pfd, final String[] args) { assertCalledBySystem(); if (mSystemThread) { if (mSystemThread) { // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot // be consumed. But it must duplicate the file descriptor first, since caller might // be consumed. But it must duplicate the file descriptor first, since caller might Loading Loading @@ -2147,14 +2081,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void unstableProviderDied(IBinder provider) { public void unstableProviderDied(IBinder provider) { assertCalledBySystem(); sendMessage(H.UNSTABLE_PROVIDER_DIED, provider); sendMessage(H.UNSTABLE_PROVIDER_DIED, provider); } } @Override @Override public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType, int sessionId, int flags) { int requestType, int sessionId, int flags) { assertCalledBySystem(); RequestAssistContextExtras cmd = new RequestAssistContextExtras(); RequestAssistContextExtras cmd = new RequestAssistContextExtras(); cmd.activityToken = activityToken; cmd.activityToken = activityToken; cmd.requestToken = requestToken; cmd.requestToken = requestToken; Loading @@ -2164,15 +2096,11 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.REQUEST_ASSIST_CONTEXT_EXTRAS, cmd); sendMessage(H.REQUEST_ASSIST_CONTEXT_EXTRAS, cmd); } } @Override public void setCoreSettings(Bundle coreSettings) { public void setCoreSettings(Bundle coreSettings) { assertCalledBySystem(); sendMessage(H.SET_CORE_SETTINGS, coreSettings); sendMessage(H.SET_CORE_SETTINGS, coreSettings); } } @Override public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) { public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) { assertCalledBySystem(); UpdateCompatibilityData ucd = new UpdateCompatibilityData(); UpdateCompatibilityData ucd = new UpdateCompatibilityData(); ucd.pkg = pkg; ucd.pkg = pkg; ucd.info = info; ucd.info = info; Loading @@ -2181,9 +2109,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.UPDATE_PACKAGE_COMPATIBILITY_INFO, ucd); sendMessage(H.UPDATE_PACKAGE_COMPATIBILITY_INFO, ucd); } } @Override public void scheduleTrimMemory(int level) { public void scheduleTrimMemory(int level) { assertCalledBySystem(); final Runnable r = PooledLambda.obtainRunnable(ActivityThread::handleTrimMemory, final Runnable r = PooledLambda.obtainRunnable(ActivityThread::handleTrimMemory, ActivityThread.this, level).recycleOnUse(); ActivityThread.this, level).recycleOnUse(); // Schedule trimming memory after drawing the frame to minimize jank-risk. // Schedule trimming memory after drawing the frame to minimize jank-risk. Loading @@ -2195,22 +2121,16 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { assertCalledBySystem(); sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); } } @Override public void scheduleOnNewSceneTransitionInfo(IBinder token, SceneTransitionInfo info) { public void scheduleOnNewSceneTransitionInfo(IBinder token, SceneTransitionInfo info) { assertCalledBySystem(); sendMessage(H.ON_NEW_SCENE_TRANSITION_INFO, sendMessage(H.ON_NEW_SCENE_TRANSITION_INFO, new Pair<IBinder, SceneTransitionInfo>(token, info)); new Pair<IBinder, SceneTransitionInfo>(token, info)); } } @Override public void setProcessState(int state) { public void setProcessState(int state) { assertCalledBySystem(); updateProcessState(state, true); updateProcessState(state, true); } } Loading @@ -2221,7 +2141,6 @@ public final class ActivityThread extends ClientTransactionHandler */ */ @Override @Override public void setNetworkBlockSeq(long procStateSeq) { public void setNetworkBlockSeq(long procStateSeq) { assertCalledBySystem(); synchronized (mNetworkPolicyLock) { synchronized (mNetworkPolicyLock) { mNetworkBlockSeq = procStateSeq; mNetworkBlockSeq = procStateSeq; } } Loading @@ -2229,13 +2148,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleInstallProvider(ProviderInfo provider) { public void scheduleInstallProvider(ProviderInfo provider) { assertCalledBySystem(); sendMessage(H.INSTALL_PROVIDER, provider); sendMessage(H.INSTALL_PROVIDER, provider); } } @Override @Override public final void updateTimePrefs(int timeFormatPreference) { public final void updateTimePrefs(int timeFormatPreference) { assertCalledBySystem(); final Boolean timeFormatPreferenceBool; final Boolean timeFormatPreferenceBool; // For convenience we are using the Intent extra values. // For convenience we are using the Intent extra values. if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { Loading @@ -2252,13 +2169,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleEnterAnimationComplete(IBinder token) { public void scheduleEnterAnimationComplete(IBinder token) { assertCalledBySystem(); sendMessage(H.ENTER_ANIMATION_COMPLETE, token); sendMessage(H.ENTER_ANIMATION_COMPLETE, token); } } @Override @Override public void notifyCleartextNetwork(byte[] firstPacket) { public void notifyCleartextNetwork(byte[] firstPacket) { assertCalledBySystem(); if (StrictMode.vmCleartextNetworkEnabled()) { if (StrictMode.vmCleartextNetworkEnabled()) { StrictMode.onCleartextNetworkDetected(firstPacket); StrictMode.onCleartextNetworkDetected(firstPacket); } } Loading @@ -2266,13 +2181,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void startBinderTracking() { public void startBinderTracking() { assertCalledBySystem(); sendMessage(H.START_BINDER_TRACKING, null); sendMessage(H.START_BINDER_TRACKING, null); } } @Override @Override public void stopBinderTrackingAndDump(ParcelFileDescriptor pfd) { public void stopBinderTrackingAndDump(ParcelFileDescriptor pfd) { assertCalledBySystem(); try { try { sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, pfd.dup()); sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, pfd.dup()); } catch (IOException e) { } catch (IOException e) { Loading @@ -2284,7 +2197,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleLocalVoiceInteractionStarted(IBinder token, public void scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor) throws RemoteException { IVoiceInteractor voiceInteractor) throws RemoteException { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = token; args.arg1 = token; args.arg2 = voiceInteractor; args.arg2 = voiceInteractor; Loading @@ -2293,20 +2205,17 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void handleTrustStorageUpdate() { public void handleTrustStorageUpdate() { assertCalledBySystem(); NetworkSecurityPolicy.getInstance().handleTrustStorageUpdate(); NetworkSecurityPolicy.getInstance().handleTrustStorageUpdate(); } } @Override @Override public void scheduleTransaction(ClientTransaction transaction) throws RemoteException { public void scheduleTransaction(ClientTransaction transaction) throws RemoteException { assertCalledBySystem(); ActivityThread.this.scheduleTransaction(transaction); ActivityThread.this.scheduleTransaction(transaction); } } @Override @Override public void scheduleTaskFragmentTransaction(@NonNull ITaskFragmentOrganizer organizer, public void scheduleTaskFragmentTransaction(@NonNull ITaskFragmentOrganizer organizer, @NonNull TaskFragmentTransaction transaction) throws RemoteException { @NonNull TaskFragmentTransaction transaction) throws RemoteException { assertCalledBySystem(); // TODO(b/352665082): ITaskFragmentOrganizer can be cleanup to be a IBinder token // TODO(b/352665082): ITaskFragmentOrganizer can be cleanup to be a IBinder token organizer.onTransactionReady(transaction); organizer.onTransactionReady(transaction); } } Loading @@ -2315,7 +2224,6 @@ public final class ActivityThread extends ClientTransactionHandler public void requestDirectActions(@NonNull IBinder activityToken, public void requestDirectActions(@NonNull IBinder activityToken, @NonNull IVoiceInteractor interactor, @Nullable RemoteCallback cancellationCallback, @NonNull IVoiceInteractor interactor, @Nullable RemoteCallback cancellationCallback, @NonNull RemoteCallback callback) { @NonNull RemoteCallback callback) { assertCalledBySystem(); final CancellationSignal cancellationSignal = new CancellationSignal(); final CancellationSignal cancellationSignal = new CancellationSignal(); if (cancellationCallback != null) { if (cancellationCallback != null) { final ICancellationSignal transport = createSafeCancellationTransport( final ICancellationSignal transport = createSafeCancellationTransport( Loading @@ -2334,7 +2242,6 @@ public final class ActivityThread extends ClientTransactionHandler public void performDirectAction(@NonNull IBinder activityToken, @NonNull String actionId, public void performDirectAction(@NonNull IBinder activityToken, @NonNull String actionId, @Nullable Bundle arguments, @Nullable RemoteCallback cancellationCallback, @Nullable Bundle arguments, @Nullable RemoteCallback cancellationCallback, @NonNull RemoteCallback resultCallback) { @NonNull RemoteCallback resultCallback) { assertCalledBySystem(); final CancellationSignal cancellationSignal = new CancellationSignal(); final CancellationSignal cancellationSignal = new CancellationSignal(); if (cancellationCallback != null) { if (cancellationCallback != null) { final ICancellationSignal transport = createSafeCancellationTransport( final ICancellationSignal transport = createSafeCancellationTransport( Loading @@ -2352,7 +2259,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, @NonNull String authorities, int userId, boolean published) { @NonNull String authorities, int userId, boolean published) { assertCalledBySystem(); final String auths[] = authorities.split(";"); final String auths[] = authorities.split(";"); for (String auth: auths) { for (String auth: auths) { final ProviderKey key = getGetProviderKey(auth, userId); final ProviderKey key = getGetProviderKey(auth, userId); Loading @@ -2367,7 +2273,6 @@ public final class ActivityThread extends ClientTransactionHandler public void instrumentWithoutRestart(ComponentName instrumentationName, public void instrumentWithoutRestart(ComponentName instrumentationName, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, IUiAutomationConnection instrumentationUiConnection, ApplicationInfo targetInfo) { IUiAutomationConnection instrumentationUiConnection, ApplicationInfo targetInfo) { assertCalledBySystem(); AppBindData data = new AppBindData(); AppBindData data = new AppBindData(); data.instrumentationName = instrumentationName; data.instrumentationName = instrumentationName; data.instrumentationArgs = instrumentationArgs; data.instrumentationArgs = instrumentationArgs; Loading @@ -2381,7 +2286,6 @@ public final class ActivityThread extends ClientTransactionHandler public void updateUiTranslationState(IBinder activityToken, int state, public void updateUiTranslationState(IBinder activityToken, int state, TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds, TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds, UiTranslationSpec uiTranslationSpec) { UiTranslationSpec uiTranslationSpec) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = activityToken; args.arg1 = activityToken; args.arg2 = state; args.arg2 = state; Loading @@ -2396,7 +2300,6 @@ public final class ActivityThread extends ClientTransactionHandler public void getExecutableMethodFileOffsets( public void getExecutableMethodFileOffsets( @NonNull MethodDescriptor methodDescriptor, @NonNull MethodDescriptor methodDescriptor, @NonNull IOffsetCallback resultCallback) { @NonNull IOffsetCallback resultCallback) { assertCalledBySystem(); Executable executable = MethodDescriptorParser.parseMethodDescriptor( Executable executable = MethodDescriptorParser.parseMethodDescriptor( getClass().getClassLoader(), methodDescriptor); getClass().getClassLoader(), methodDescriptor); VMDebug.ExecutableMethodFileOffsets location; VMDebug.ExecutableMethodFileOffsets location; Loading @@ -2421,29 +2324,6 @@ public final class ActivityThread extends ClientTransactionHandler throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } } } private void assertCalledBySystem() { int callingUid = Binder.getCallingUid(); if (callingUid != Process.SYSTEM_UID) { String packageName; if (callingUid == Process.ROOT_UID) { packageName = "root"; } else { String[] packagesForUid = getSystemContext().getPackageManager().getPackagesForUid(callingUid); if (packagesForUid == null || packagesForUid.length == 0) { packageName = "unknown"; } else if (packagesForUid.length == 1) { packageName = packagesForUid[0]; } else { packageName = Arrays.asList(packagesForUid).stream().sorted().collect( Collectors.joining(", ")); } } Slog.wtf(TAG, "ApplicationThread called by non-system process" + " (" + callingUid + "): " + packageName); } } } } private @NonNull SafeCancellationTransport createSafeCancellationTransport( private @NonNull SafeCancellationTransport createSafeCancellationTransport( Loading Loading
core/java/android/app/ActivityThread.java +1 −121 Original line number Original line Diff line number Diff line Loading @@ -254,8 +254,8 @@ import com.android.internal.util.FastPrintWriter; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.util.function.pooled.PooledLambda; import com.android.internal.util.function.pooled.PooledLambda; import com.android.org.conscrypt.TrustedCertificateStore; import com.android.org.conscrypt.TrustedCertificateStore; import com.android.server.am.BitmapDumpProto; import com.android.server.am.MemInfoDumpProto; import com.android.server.am.MemInfoDumpProto; import com.android.server.am.BitmapDumpProto; import dalvik.annotation.optimization.NeverCompile; import dalvik.annotation.optimization.NeverCompile; import dalvik.system.AppSpecializationHooks; import dalvik.system.AppSpecializationHooks; Loading Loading @@ -298,7 +298,6 @@ import java.util.TimeZone; import java.util.concurrent.Executor; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.function.Consumer; import java.util.stream.Collectors; /** /** * This manages the execution of the main thread in an * This manages the execution of the main thread in an Loading Loading @@ -1149,12 +1148,10 @@ public final class ActivityThread extends ClientTransactionHandler private static final String DB_POOL_INFO_HEADER = " %13s %13s %13s %s"; private static final String DB_POOL_INFO_HEADER = " %13s %13s %13s %s"; private static final String DB_POOL_INFO_FORMAT = " %13d %13d %13d %s"; private static final String DB_POOL_INFO_FORMAT = " %13d %13d %13d %s"; @Override public final void scheduleReceiver(Intent intent, ActivityInfo info, public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) { int sendingUid, String sendingPackage) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, Loading @@ -1166,9 +1163,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.RECEIVER, r); sendMessage(H.RECEIVER, r); } } @Override public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { assertCalledBySystem(); for (int i = 0; i < info.size(); i++) { for (int i = 0; i < info.size(); i++) { ReceiverInfo r = info.get(i); ReceiverInfo r = info.get(i); if (r.registered) { if (r.registered) { Loading @@ -1185,10 +1180,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void scheduleCreateBackupAgent(ApplicationInfo app, public final void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode, int userId, @BackupDestination int backupDestination) { int backupMode, int userId, @BackupDestination int backupDestination) { assertCalledBySystem(); CreateBackupAgentData d = new CreateBackupAgentData(); CreateBackupAgentData d = new CreateBackupAgentData(); d.appInfo = app; d.appInfo = app; d.backupMode = backupMode; d.backupMode = backupMode; Loading @@ -1198,9 +1191,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.CREATE_BACKUP_AGENT, d); sendMessage(H.CREATE_BACKUP_AGENT, d); } } @Override public final void scheduleDestroyBackupAgent(ApplicationInfo app, int userId) { public final void scheduleDestroyBackupAgent(ApplicationInfo app, int userId) { assertCalledBySystem(); CreateBackupAgentData d = new CreateBackupAgentData(); CreateBackupAgentData d = new CreateBackupAgentData(); d.appInfo = app; d.appInfo = app; d.userId = userId; d.userId = userId; Loading @@ -1208,10 +1199,8 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.DESTROY_BACKUP_AGENT, d); sendMessage(H.DESTROY_BACKUP_AGENT, d); } } @Override public final void scheduleCreateService(IBinder token, public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo, int processState) { ServiceInfo info, CompatibilityInfo compatInfo, int processState) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); CreateServiceData s = new CreateServiceData(); CreateServiceData s = new CreateServiceData(); s.token = token; s.token = token; Loading @@ -1227,10 +1216,8 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.CREATE_SERVICE, s); sendMessage(H.CREATE_SERVICE, s); } } @Override public final void scheduleBindService(IBinder token, IBinder bindToken, Intent intent, public final void scheduleBindService(IBinder token, IBinder bindToken, Intent intent, boolean rebind, int processState, long bindSeq) { boolean rebind, int processState, long bindSeq) { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); BindServiceData s = new BindServiceData(); BindServiceData s = new BindServiceData(); s.token = token; s.token = token; Loading @@ -1254,9 +1241,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.BIND_SERVICE, s); sendMessage(H.BIND_SERVICE, s); } } @Override public final void scheduleUnbindService(IBinder token, IBinder bindToken, Intent intent) { public final void scheduleUnbindService(IBinder token, IBinder bindToken, Intent intent) { assertCalledBySystem(); BindServiceData s = new BindServiceData(); BindServiceData s = new BindServiceData(); s.token = token; s.token = token; s.bindToken = bindToken; s.bindToken = bindToken; Loading @@ -1270,9 +1255,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.UNBIND_SERVICE, s); sendMessage(H.UNBIND_SERVICE, s); } } @Override public final void scheduleServiceArgs(IBinder token, ParceledListSlice args) { public final void scheduleServiceArgs(IBinder token, ParceledListSlice args) { assertCalledBySystem(); List<ServiceStartArgs> list = args.getList(); List<ServiceStartArgs> list = args.getList(); for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) { Loading @@ -1295,9 +1278,7 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void scheduleStopService(IBinder token) { public final void scheduleStopService(IBinder token) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleStopService. token=" Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleStopService. token=" + token); + token); Loading @@ -1307,7 +1288,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public final void scheduleTimeoutService(IBinder token, int startId) { public final void scheduleTimeoutService(IBinder token, int startId) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutService. token=" Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutService. token=" + token); + token); Loading @@ -1317,14 +1297,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public final void schedulePing(RemoteCallback pong) { public final void schedulePing(RemoteCallback pong) { assertCalledBySystem(); sendMessage(H.PING, pong); sendMessage(H.PING, pong); } } @Override @Override public final void scheduleTimeoutServiceForType(IBinder token, int startId, public final void scheduleTimeoutServiceForType(IBinder token, int startId, @ServiceInfo.ForegroundServiceType int fgsType) { @ServiceInfo.ForegroundServiceType int fgsType) { assertCalledBySystem(); if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleTimeoutServiceForType. token=" + token); "scheduleTimeoutServiceForType. token=" + token); Loading Loading @@ -1363,7 +1341,6 @@ public final class ActivityThread extends ClientTransactionHandler FileDescriptor applicationSharedMemoryFd, FileDescriptor applicationSharedMemoryFd, long startRequestedElapsedTime, long startRequestedElapsedTime, long startRequestedUptime) { long startRequestedUptime) { assertCalledBySystem(); if (DEBUG_STORE_ENABLED) { if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBindApplication(); DebugStore.recordScheduleBindApplication(); } } Loading Loading @@ -1459,30 +1436,22 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public final void runIsolatedEntryPoint(String entryPoint, String[] entryPointArgs) { public final void runIsolatedEntryPoint(String entryPoint, String[] entryPointArgs) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = entryPoint; args.arg1 = entryPoint; args.arg2 = entryPointArgs; args.arg2 = entryPointArgs; sendMessage(H.RUN_ISOLATED_ENTRY_POINT, args); sendMessage(H.RUN_ISOLATED_ENTRY_POINT, args); } } @Override public final void scheduleExit() { public final void scheduleExit() { assertCalledBySystem(); sendMessage(H.EXIT_APPLICATION, null); sendMessage(H.EXIT_APPLICATION, null); } } @Override public final void scheduleSuicide() { public final void scheduleSuicide() { assertCalledBySystem(); sendMessage(H.SUICIDE, null); sendMessage(H.SUICIDE, null); } } @Override public void scheduleApplicationInfoChanged(ApplicationInfo ai) { public void scheduleApplicationInfoChanged(ApplicationInfo ai) { assertCalledBySystem(); synchronized (mResourcesManager) { synchronized (mResourcesManager) { var oldAi = mPendingAppInfoUpdates.put(ai.packageName, ai); var oldAi = mPendingAppInfoUpdates.put(ai.packageName, ai); if (oldAi != null && oldAi.createTimestamp > ai.createTimestamp) { if (oldAi != null && oldAi.createTimestamp > ai.createTimestamp) { Loading @@ -1498,15 +1467,11 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.APPLICATION_INFO_CHANGED, ai.packageName); sendMessage(H.APPLICATION_INFO_CHANGED, ai.packageName); } } @Override public void updateTimeZone() { public void updateTimeZone() { assertCalledBySystem(); TimeZone.setDefault(null); TimeZone.setDefault(null); } } @Override public void clearDnsCache() { public void clearDnsCache() { assertCalledBySystem(); // a non-standard API to get this to libcore // a non-standard API to get this to libcore InetAddress.clearDnsCache(); InetAddress.clearDnsCache(); // Allow libcore to perform the necessary actions as it sees fit upon a network // Allow libcore to perform the necessary actions as it sees fit upon a network Loading @@ -1514,9 +1479,7 @@ public final class ActivityThread extends ClientTransactionHandler NetworkEventDispatcher.getInstance().dispatchNetworkConfigurationChange(); NetworkEventDispatcher.getInstance().dispatchNetworkConfigurationChange(); } } @Override public void updateHttpProxy() { public void updateHttpProxy() { assertCalledBySystem(); final Application app; final Application app; synchronized (ActivityThread.this) { synchronized (ActivityThread.this) { app = getApplication(); app = getApplication(); Loading @@ -1531,16 +1494,12 @@ public final class ActivityThread extends ClientTransactionHandler ActivityThread.updateHttpProxy(app); ActivityThread.updateHttpProxy(app); } } @Override public void processInBackground() { public void processInBackground() { assertCalledBySystem(); mH.removeMessages(H.GC_WHEN_IDLE); mH.removeMessages(H.GC_WHEN_IDLE); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); } } @Override public void dumpService(ParcelFileDescriptor pfd, IBinder servicetoken, String[] args) { public void dumpService(ParcelFileDescriptor pfd, IBinder servicetoken, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1557,13 +1516,11 @@ public final class ActivityThread extends ClientTransactionHandler // This function exists to make sure all receiver dispatching is // This function exists to make sure all receiver dispatching is // correctly ordered, since these are one-way calls and the binder driver // correctly ordered, since these are one-way calls and the binder driver // applies transaction ordering per object for such calls. // applies transaction ordering per object for such calls. @Override public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, boolean assumeDelivered, int sendingUser, int processState, boolean sticky, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) int sendingUid, String sendingPackage) throws RemoteException { throws RemoteException { assertCalledBySystem(); updateProcessState(processState, false); updateProcessState(processState, false); // We can't modify IIntentReceiver due to UnsupportedAppUsage, so // We can't modify IIntentReceiver due to UnsupportedAppUsage, so Loading Loading @@ -1592,20 +1549,17 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleLowMemory() { public void scheduleLowMemory() { assertCalledBySystem(); sendMessage(H.LOW_MEMORY, null); sendMessage(H.LOW_MEMORY, null); } } @Override @Override public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType) { public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType) { assertCalledBySystem(); sendMessage(H.PROFILER_CONTROL, profilerInfo, start ? 1 : 0, profileType); sendMessage(H.PROFILER_CONTROL, profilerInfo, start ? 1 : 0, profileType); } } @Override @Override public void dumpHeap(boolean managed, boolean mallocInfo, boolean runGc, String dumpBitmaps, public void dumpHeap(boolean managed, boolean mallocInfo, boolean runGc, String dumpBitmaps, String path, ParcelFileDescriptor fd, RemoteCallback finishCallback) { String path, ParcelFileDescriptor fd, RemoteCallback finishCallback) { assertCalledBySystem(); DumpHeapData dhd = new DumpHeapData(); DumpHeapData dhd = new DumpHeapData(); dhd.managed = managed; dhd.managed = managed; dhd.mallocInfo = mallocInfo; dhd.mallocInfo = mallocInfo; Loading @@ -1626,21 +1580,15 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.DUMP_HEAP, dhd, 0, 0, true /*async*/); sendMessage(H.DUMP_HEAP, dhd, 0, 0, true /*async*/); } } @Override public void attachAgent(String agent) { public void attachAgent(String agent) { assertCalledBySystem(); sendMessage(H.ATTACH_AGENT, agent); sendMessage(H.ATTACH_AGENT, agent); } } @Override public void attachStartupAgents(String dataDir) { public void attachStartupAgents(String dataDir) { assertCalledBySystem(); sendMessage(H.ATTACH_STARTUP_AGENTS, dataDir); sendMessage(H.ATTACH_STARTUP_AGENTS, dataDir); } } @Override public void setSchedulingGroup(int group) { public void setSchedulingGroup(int group) { assertCalledBySystem(); // Note: do this immediately, since going into the foreground // Note: do this immediately, since going into the foreground // should happen regardless of what pending work we have to do // should happen regardless of what pending work we have to do // and the activity manager will wait for us to report back that // and the activity manager will wait for us to report back that Loading @@ -1652,15 +1600,12 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dispatchPackageBroadcast(int cmd, String[] packages) { public void dispatchPackageBroadcast(int cmd, String[] packages) { assertCalledBySystem(); sendMessage(H.DISPATCH_PACKAGE_BROADCAST, packages, cmd); sendMessage(H.DISPATCH_PACKAGE_BROADCAST, packages, cmd); } } @Override @Override public void scheduleCrash(String msg, int typeId, @Nullable Bundle extras) { public void scheduleCrash(String msg, int typeId, @Nullable Bundle extras) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = msg; args.arg1 = msg; args.arg2 = extras; args.arg2 = extras; Loading @@ -1669,7 +1614,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpResources(ParcelFileDescriptor fd, RemoteCallback callback) { public void dumpResources(ParcelFileDescriptor fd, RemoteCallback callback) { assertCalledBySystem(); DumpResourcesData data = new DumpResourcesData(); DumpResourcesData data = new DumpResourcesData(); try { try { data.fd = fd.dup(); data.fd = fd.dup(); Loading @@ -1682,10 +1626,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dumpActivity(ParcelFileDescriptor pfd, IBinder activitytoken, public void dumpActivity(ParcelFileDescriptor pfd, IBinder activitytoken, String prefix, String[] args) { String prefix, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1700,10 +1642,8 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void dumpProvider(ParcelFileDescriptor pfd, IBinder providertoken, public void dumpProvider(ParcelFileDescriptor pfd, IBinder providertoken, String[] args) { String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -1722,7 +1662,6 @@ public final class ActivityThread extends ClientTransactionHandler public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { assertCalledBySystem(); FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); PrintWriter pw = new FastPrintWriter(fout); PrintWriter pw = new FastPrintWriter(fout); try { try { Loading Loading @@ -1930,7 +1869,6 @@ public final class ActivityThread extends ClientTransactionHandler public void dumpMemInfoProto(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, public void dumpMemInfoProto(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, String[] args) { boolean dumpUnreachable, String[] args) { assertCalledBySystem(); ProtoOutputStream proto = new ProtoOutputStream(pfd.getFileDescriptor()); ProtoOutputStream proto = new ProtoOutputStream(pfd.getFileDescriptor()); try { try { dumpMemInfo(proto, mem, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); dumpMemInfo(proto, mem, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); Loading Loading @@ -2058,7 +1996,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpGfxInfo(ParcelFileDescriptor pfd, String[] args) { public void dumpGfxInfo(ParcelFileDescriptor pfd, String[] args) { assertCalledBySystem(); DumpComponentInfo data = new DumpComponentInfo(); DumpComponentInfo data = new DumpComponentInfo(); try { try { data.fd = pfd.dup(); data.fd = pfd.dup(); Loading @@ -2075,7 +2012,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override @NeverCompile @NeverCompile public void dumpBitmapsProto(ParcelFileDescriptor pfd, String dumpFormat) { public void dumpBitmapsProto(ParcelFileDescriptor pfd, String dumpFormat) { assertCalledBySystem(); try { try { int pid = Process.myPid(); int pid = Process.myPid(); String processName = (mBoundApplication != null) String processName = (mBoundApplication != null) Loading @@ -2090,7 +2026,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpCacheInfo(ParcelFileDescriptor pfd, String[] args) { public void dumpCacheInfo(ParcelFileDescriptor pfd, String[] args) { assertCalledBySystem(); try { try { PropertyInvalidatedCache.dumpCacheInfo(pfd, args); PropertyInvalidatedCache.dumpCacheInfo(pfd, args); BroadcastStickyCache.dumpCacheInfo(pfd); BroadcastStickyCache.dumpCacheInfo(pfd); Loading @@ -2114,7 +2049,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void dumpDbInfo(final ParcelFileDescriptor pfd, final String[] args) { public void dumpDbInfo(final ParcelFileDescriptor pfd, final String[] args) { assertCalledBySystem(); if (mSystemThread) { if (mSystemThread) { // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot // be consumed. But it must duplicate the file descriptor first, since caller might // be consumed. But it must duplicate the file descriptor first, since caller might Loading Loading @@ -2147,14 +2081,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void unstableProviderDied(IBinder provider) { public void unstableProviderDied(IBinder provider) { assertCalledBySystem(); sendMessage(H.UNSTABLE_PROVIDER_DIED, provider); sendMessage(H.UNSTABLE_PROVIDER_DIED, provider); } } @Override @Override public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType, int sessionId, int flags) { int requestType, int sessionId, int flags) { assertCalledBySystem(); RequestAssistContextExtras cmd = new RequestAssistContextExtras(); RequestAssistContextExtras cmd = new RequestAssistContextExtras(); cmd.activityToken = activityToken; cmd.activityToken = activityToken; cmd.requestToken = requestToken; cmd.requestToken = requestToken; Loading @@ -2164,15 +2096,11 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.REQUEST_ASSIST_CONTEXT_EXTRAS, cmd); sendMessage(H.REQUEST_ASSIST_CONTEXT_EXTRAS, cmd); } } @Override public void setCoreSettings(Bundle coreSettings) { public void setCoreSettings(Bundle coreSettings) { assertCalledBySystem(); sendMessage(H.SET_CORE_SETTINGS, coreSettings); sendMessage(H.SET_CORE_SETTINGS, coreSettings); } } @Override public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) { public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) { assertCalledBySystem(); UpdateCompatibilityData ucd = new UpdateCompatibilityData(); UpdateCompatibilityData ucd = new UpdateCompatibilityData(); ucd.pkg = pkg; ucd.pkg = pkg; ucd.info = info; ucd.info = info; Loading @@ -2181,9 +2109,7 @@ public final class ActivityThread extends ClientTransactionHandler sendMessage(H.UPDATE_PACKAGE_COMPATIBILITY_INFO, ucd); sendMessage(H.UPDATE_PACKAGE_COMPATIBILITY_INFO, ucd); } } @Override public void scheduleTrimMemory(int level) { public void scheduleTrimMemory(int level) { assertCalledBySystem(); final Runnable r = PooledLambda.obtainRunnable(ActivityThread::handleTrimMemory, final Runnable r = PooledLambda.obtainRunnable(ActivityThread::handleTrimMemory, ActivityThread.this, level).recycleOnUse(); ActivityThread.this, level).recycleOnUse(); // Schedule trimming memory after drawing the frame to minimize jank-risk. // Schedule trimming memory after drawing the frame to minimize jank-risk. Loading @@ -2195,22 +2121,16 @@ public final class ActivityThread extends ClientTransactionHandler } } } } @Override public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { assertCalledBySystem(); sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); } } @Override public void scheduleOnNewSceneTransitionInfo(IBinder token, SceneTransitionInfo info) { public void scheduleOnNewSceneTransitionInfo(IBinder token, SceneTransitionInfo info) { assertCalledBySystem(); sendMessage(H.ON_NEW_SCENE_TRANSITION_INFO, sendMessage(H.ON_NEW_SCENE_TRANSITION_INFO, new Pair<IBinder, SceneTransitionInfo>(token, info)); new Pair<IBinder, SceneTransitionInfo>(token, info)); } } @Override public void setProcessState(int state) { public void setProcessState(int state) { assertCalledBySystem(); updateProcessState(state, true); updateProcessState(state, true); } } Loading @@ -2221,7 +2141,6 @@ public final class ActivityThread extends ClientTransactionHandler */ */ @Override @Override public void setNetworkBlockSeq(long procStateSeq) { public void setNetworkBlockSeq(long procStateSeq) { assertCalledBySystem(); synchronized (mNetworkPolicyLock) { synchronized (mNetworkPolicyLock) { mNetworkBlockSeq = procStateSeq; mNetworkBlockSeq = procStateSeq; } } Loading @@ -2229,13 +2148,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleInstallProvider(ProviderInfo provider) { public void scheduleInstallProvider(ProviderInfo provider) { assertCalledBySystem(); sendMessage(H.INSTALL_PROVIDER, provider); sendMessage(H.INSTALL_PROVIDER, provider); } } @Override @Override public final void updateTimePrefs(int timeFormatPreference) { public final void updateTimePrefs(int timeFormatPreference) { assertCalledBySystem(); final Boolean timeFormatPreferenceBool; final Boolean timeFormatPreferenceBool; // For convenience we are using the Intent extra values. // For convenience we are using the Intent extra values. if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { Loading @@ -2252,13 +2169,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleEnterAnimationComplete(IBinder token) { public void scheduleEnterAnimationComplete(IBinder token) { assertCalledBySystem(); sendMessage(H.ENTER_ANIMATION_COMPLETE, token); sendMessage(H.ENTER_ANIMATION_COMPLETE, token); } } @Override @Override public void notifyCleartextNetwork(byte[] firstPacket) { public void notifyCleartextNetwork(byte[] firstPacket) { assertCalledBySystem(); if (StrictMode.vmCleartextNetworkEnabled()) { if (StrictMode.vmCleartextNetworkEnabled()) { StrictMode.onCleartextNetworkDetected(firstPacket); StrictMode.onCleartextNetworkDetected(firstPacket); } } Loading @@ -2266,13 +2181,11 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void startBinderTracking() { public void startBinderTracking() { assertCalledBySystem(); sendMessage(H.START_BINDER_TRACKING, null); sendMessage(H.START_BINDER_TRACKING, null); } } @Override @Override public void stopBinderTrackingAndDump(ParcelFileDescriptor pfd) { public void stopBinderTrackingAndDump(ParcelFileDescriptor pfd) { assertCalledBySystem(); try { try { sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, pfd.dup()); sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, pfd.dup()); } catch (IOException e) { } catch (IOException e) { Loading @@ -2284,7 +2197,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void scheduleLocalVoiceInteractionStarted(IBinder token, public void scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor) throws RemoteException { IVoiceInteractor voiceInteractor) throws RemoteException { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = token; args.arg1 = token; args.arg2 = voiceInteractor; args.arg2 = voiceInteractor; Loading @@ -2293,20 +2205,17 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void handleTrustStorageUpdate() { public void handleTrustStorageUpdate() { assertCalledBySystem(); NetworkSecurityPolicy.getInstance().handleTrustStorageUpdate(); NetworkSecurityPolicy.getInstance().handleTrustStorageUpdate(); } } @Override @Override public void scheduleTransaction(ClientTransaction transaction) throws RemoteException { public void scheduleTransaction(ClientTransaction transaction) throws RemoteException { assertCalledBySystem(); ActivityThread.this.scheduleTransaction(transaction); ActivityThread.this.scheduleTransaction(transaction); } } @Override @Override public void scheduleTaskFragmentTransaction(@NonNull ITaskFragmentOrganizer organizer, public void scheduleTaskFragmentTransaction(@NonNull ITaskFragmentOrganizer organizer, @NonNull TaskFragmentTransaction transaction) throws RemoteException { @NonNull TaskFragmentTransaction transaction) throws RemoteException { assertCalledBySystem(); // TODO(b/352665082): ITaskFragmentOrganizer can be cleanup to be a IBinder token // TODO(b/352665082): ITaskFragmentOrganizer can be cleanup to be a IBinder token organizer.onTransactionReady(transaction); organizer.onTransactionReady(transaction); } } Loading @@ -2315,7 +2224,6 @@ public final class ActivityThread extends ClientTransactionHandler public void requestDirectActions(@NonNull IBinder activityToken, public void requestDirectActions(@NonNull IBinder activityToken, @NonNull IVoiceInteractor interactor, @Nullable RemoteCallback cancellationCallback, @NonNull IVoiceInteractor interactor, @Nullable RemoteCallback cancellationCallback, @NonNull RemoteCallback callback) { @NonNull RemoteCallback callback) { assertCalledBySystem(); final CancellationSignal cancellationSignal = new CancellationSignal(); final CancellationSignal cancellationSignal = new CancellationSignal(); if (cancellationCallback != null) { if (cancellationCallback != null) { final ICancellationSignal transport = createSafeCancellationTransport( final ICancellationSignal transport = createSafeCancellationTransport( Loading @@ -2334,7 +2242,6 @@ public final class ActivityThread extends ClientTransactionHandler public void performDirectAction(@NonNull IBinder activityToken, @NonNull String actionId, public void performDirectAction(@NonNull IBinder activityToken, @NonNull String actionId, @Nullable Bundle arguments, @Nullable RemoteCallback cancellationCallback, @Nullable Bundle arguments, @Nullable RemoteCallback cancellationCallback, @NonNull RemoteCallback resultCallback) { @NonNull RemoteCallback resultCallback) { assertCalledBySystem(); final CancellationSignal cancellationSignal = new CancellationSignal(); final CancellationSignal cancellationSignal = new CancellationSignal(); if (cancellationCallback != null) { if (cancellationCallback != null) { final ICancellationSignal transport = createSafeCancellationTransport( final ICancellationSignal transport = createSafeCancellationTransport( Loading @@ -2352,7 +2259,6 @@ public final class ActivityThread extends ClientTransactionHandler @Override @Override public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, @NonNull String authorities, int userId, boolean published) { @NonNull String authorities, int userId, boolean published) { assertCalledBySystem(); final String auths[] = authorities.split(";"); final String auths[] = authorities.split(";"); for (String auth: auths) { for (String auth: auths) { final ProviderKey key = getGetProviderKey(auth, userId); final ProviderKey key = getGetProviderKey(auth, userId); Loading @@ -2367,7 +2273,6 @@ public final class ActivityThread extends ClientTransactionHandler public void instrumentWithoutRestart(ComponentName instrumentationName, public void instrumentWithoutRestart(ComponentName instrumentationName, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, IUiAutomationConnection instrumentationUiConnection, ApplicationInfo targetInfo) { IUiAutomationConnection instrumentationUiConnection, ApplicationInfo targetInfo) { assertCalledBySystem(); AppBindData data = new AppBindData(); AppBindData data = new AppBindData(); data.instrumentationName = instrumentationName; data.instrumentationName = instrumentationName; data.instrumentationArgs = instrumentationArgs; data.instrumentationArgs = instrumentationArgs; Loading @@ -2381,7 +2286,6 @@ public final class ActivityThread extends ClientTransactionHandler public void updateUiTranslationState(IBinder activityToken, int state, public void updateUiTranslationState(IBinder activityToken, int state, TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds, TranslationSpec sourceSpec, TranslationSpec targetSpec, List<AutofillId> viewIds, UiTranslationSpec uiTranslationSpec) { UiTranslationSpec uiTranslationSpec) { assertCalledBySystem(); SomeArgs args = SomeArgs.obtain(); SomeArgs args = SomeArgs.obtain(); args.arg1 = activityToken; args.arg1 = activityToken; args.arg2 = state; args.arg2 = state; Loading @@ -2396,7 +2300,6 @@ public final class ActivityThread extends ClientTransactionHandler public void getExecutableMethodFileOffsets( public void getExecutableMethodFileOffsets( @NonNull MethodDescriptor methodDescriptor, @NonNull MethodDescriptor methodDescriptor, @NonNull IOffsetCallback resultCallback) { @NonNull IOffsetCallback resultCallback) { assertCalledBySystem(); Executable executable = MethodDescriptorParser.parseMethodDescriptor( Executable executable = MethodDescriptorParser.parseMethodDescriptor( getClass().getClassLoader(), methodDescriptor); getClass().getClassLoader(), methodDescriptor); VMDebug.ExecutableMethodFileOffsets location; VMDebug.ExecutableMethodFileOffsets location; Loading @@ -2421,29 +2324,6 @@ public final class ActivityThread extends ClientTransactionHandler throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } } } private void assertCalledBySystem() { int callingUid = Binder.getCallingUid(); if (callingUid != Process.SYSTEM_UID) { String packageName; if (callingUid == Process.ROOT_UID) { packageName = "root"; } else { String[] packagesForUid = getSystemContext().getPackageManager().getPackagesForUid(callingUid); if (packagesForUid == null || packagesForUid.length == 0) { packageName = "unknown"; } else if (packagesForUid.length == 1) { packageName = packagesForUid[0]; } else { packageName = Arrays.asList(packagesForUid).stream().sorted().collect( Collectors.joining(", ")); } } Slog.wtf(TAG, "ApplicationThread called by non-system process" + " (" + callingUid + "): " + packageName); } } } } private @NonNull SafeCancellationTransport createSafeCancellationTransport( private @NonNull SafeCancellationTransport createSafeCancellationTransport( Loading