android.app.IApplicationThread Java Examples

The following examples show how to use android.app.IApplicationThread. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 6 votes vote down vote up
public final int broadcastIntent(IApplicationThread caller,
                                 Intent intent, String resolvedType, IIntentReceiver resultTo,
                                 int resultCode, String resultData, Bundle map,
                                 String requiredPermission, int appOp, boolean serialized, boolean sticky, int userId) {
    try {
        PreventRunningUtils.setSender(caller);
        int res = broadcastIntent$Pr(caller,
                intent, resolvedType, resultTo,
                resultCode, resultData, map,
                requiredPermission, appOp, serialized, sticky, userId);
        if (res == 0) {
            PreventRunningUtils.onBroadcastIntent(intent);
        }
        return res;
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #2
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 6 votes vote down vote up
public final int broadcastIntent(IApplicationThread caller,
                                 Intent intent, String resolvedType, IIntentReceiver resultTo,
                                 int resultCode, String resultData, Bundle resultExtras,
                                 String[] requiredPermissions, int appOp, Bundle bOptions,
                                 boolean serialized, boolean sticky, int userId) {
    try {
        PreventRunningUtils.setSender(caller);
        int res = broadcastIntent$Pr(caller,
                intent, resolvedType, resultTo,
                resultCode, resultData, resultExtras,
                requiredPermissions, appOp, bOptions,
                serialized, sticky, userId);
        if (res == 0) {
            PreventRunningUtils.onBroadcastIntent(intent);
        }
        return res;
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #3
Source File: ProcessRecord.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void makeActive(IApplicationThread _thread, ProcessStatsService tracker) {
    if (thread == null) {
        final ProcessState origBase = baseProcessTracker;
        if (origBase != null) {
            origBase.setState(ProcessStats.STATE_NOTHING,
                    tracker.getMemFactorLocked(), SystemClock.uptimeMillis(), pkgList);
            origBase.makeInactive();
        }
        baseProcessTracker = tracker.getProcessStateLocked(info.packageName, uid,
                info.longVersionCode, processName);
        baseProcessTracker.makeActive();
        for (int i=0; i<pkgList.size(); i++) {
            ProcessStats.ProcessStateHolder holder = pkgList.valueAt(i);
            if (holder.state != null && holder.state != origBase) {
                holder.state.makeInactive();
            }
            holder.state = tracker.getProcessStateLocked(pkgList.keyAt(i), uid,
                    info.longVersionCode, processName);
            if (holder.state != baseProcessTracker) {
                holder.state.makeActive();
            }
        }
    }
    thread = _thread;
}
 
Example #4
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int startActivity(IApplicationThread caller, Intent intent, String resolvedType, IBinder resultTo,
                         String resultWho, int requestCode, int flags, String profileFile, ParcelFileDescriptor profileFd,
                         Bundle options) {

    RemapingUtil.remapActivityIntent(mHostContext, intent);

    return mTarget.startActivity(caller, intent, resolvedType, resultTo, resultWho, requestCode,
            flags, profileFile, profileFd, options);
}
 
Example #5
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType,
                         IBinder resultTo, String resultWho, int requestCode, int flags, ProfilerInfo profilerInfo, Bundle options) {

    RemapingUtil.remapActivityIntent(mHostContext, intent);

    return mTarget.startActivity(caller, callingPackage, intent, resolvedType, resultTo, resultWho, requestCode,
            flags, profilerInfo, options);
}
 
Example #6
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int startActivity(IApplicationThread caller, Intent intent, String resolvedType,
                         Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode,
                         boolean onlyIfNeeded, boolean debug) {

    RemapingUtil.remapActivityIntent(mHostContext, intent);

    return mTarget.startActivity(caller, intent, resolvedType, grantedUriPermissions, grantedMode,
            resultTo, resultWho, requestCode, onlyIfNeeded, debug);
}
 
Example #7
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * 5.x 6.0
 */
public ContentProviderHolder getContentProvider(IApplicationThread caller, String name, int userId, boolean stable) {
    ContentProviderHolder holder = getContentProviderHolder(mHostContext, name);
    if (holder != null) {
        return holder;
    }

    return mTarget.getContentProvider(caller, name, userId, stable);
}
 
Example #8
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * 4.x
 */
public ContentProviderHolder getContentProvider(IApplicationThread caller, String name, boolean stable) {
    ContentProviderHolder holder = getContentProviderHolder(mHostContext, name);
    if (holder != null) {
        return holder;
    }

    return mTarget.getContentProvider(caller, name, stable);
}
 
Example #9
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * 2.3
 */
public ContentProviderHolder getContentProvider(IApplicationThread caller, String name) {
    ContentProviderHolder holder = getContentProviderHolder(mHostContext, name);
    if (holder != null) {
        return holder;
    }

    return mTarget.getContentProvider(caller, name);
}
 
Example #10
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * android 6.x
 */
public int broadcastIntent(IApplicationThread caller, Intent intent,
                           String resolvedType, IIntentReceiver resultTo, int resultCode,
                           String resultData, Bundle map, String[] requiredPermissions,
                           int appOp, Bundle options, boolean serialized, boolean sticky, int userId) {

    remapBroadcastIntent(intent);

    return mTarget.broadcastIntent(caller, intent, resolvedType, resultTo, resultCode, resultData, map,
            requiredPermissions, appOp, options, serialized, sticky, userId);

}
 
Example #11
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * android 5.x
 */
public int broadcastIntent(IApplicationThread caller, Intent intent,
                           String resolvedType, IIntentReceiver resultTo, int resultCode,
                           String resultData, Bundle map, String requiredPermission,
                           int appOp, boolean serialized, boolean sticky, int userId) {

    remapBroadcastIntent(intent);

    return mTarget.broadcastIntent(caller, intent, resolvedType, resultTo, resultCode, resultData, map,
            requiredPermission, appOp, serialized, sticky, userId);
}
 
Example #12
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * android 4.x
 */
public int broadcastIntent(IApplicationThread caller, Intent intent,
                           String resolvedType, IIntentReceiver resultTo, int resultCode,
                           String resultData, Bundle map, String requiredPermission,
                           boolean serialized, boolean sticky, int userId) {

    remapBroadcastIntent(intent);

    return mTarget.broadcastIntent(caller, intent, resolvedType, resultTo, resultCode, resultData, map,
            requiredPermission, serialized, sticky, userId);
}
 
Example #13
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * android 2.x
 */
public int broadcastIntent(IApplicationThread caller, Intent intent,
                           String resolvedType, IIntentReceiver resultTo, int resultCode,
                           String resultData, Bundle map, String requiredPermission,
                           boolean serialized, boolean sticky) {

    remapBroadcastIntent(intent);

    return mTarget.broadcastIntent(caller, intent, resolvedType, resultTo, resultCode,
            resultData, map, requiredPermission, serialized, sticky);
}
 
Example #14
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * android 6.0
 */
public int bindService(IApplicationThread caller, IBinder token, Intent service,
                       String resolvedType, IServiceConnection connection, int flags,
                       String callingPackage, int userId) {

    RemapingUtil.remapServiceIntent(mHostContext, service);

    return mTarget.bindService(caller, token, service, resolvedType, connection, flags, callingPackage, userId);
}
 
Example #15
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int bindService(IApplicationThread caller, IBinder token,
                       Intent service, String resolvedType,
                       IServiceConnection connection, int flags, int userId) {

    token = getActivityToken(token);

    RemapingUtil.remapServiceIntent(mHostContext, service);

    if (userId == INVALID_USER_ID) {
        return mTarget.bindService(caller, token, service, resolvedType, connection, flags);
    } else {
        return mTarget.bindService(caller, token, service, resolvedType, connection, flags, userId);
    }
}
 
Example #16
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int stopService(IApplicationThread caller, Intent service,
                       String resolvedType, int userId) {

    if (service.getComponent() != null && ProxyEnvironment.hasInstance(service.getComponent().getPackageName())) {
        return ServiceProxy.stopServiceExternal(service.getComponent());
    } else {
        return mTarget.stopService(caller, service, resolvedType, userId);
    }
}
 
Example #17
Source File: ClientLifecycleManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * @return A new instance of {@link ClientTransaction} with a single callback invocation.
 *
 * @see ClientTransaction
 * @see ClientTransactionItem
 */
private static ClientTransaction transactionWithCallback(@NonNull IApplicationThread client,
        IBinder activityToken, @NonNull ClientTransactionItem callback) {
    final ClientTransaction clientTransaction = ClientTransaction.obtain(client, activityToken);
    clientTransaction.addCallback(callback);
    return clientTransaction;
}
 
Example #18
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType,
                         IBinder resultTo, String resultWho, int requestCode, int flags, String profileFile,
                         ParcelFileDescriptor profileFd, Bundle options) {
    try {
        RemapingUtil.remapActivityIntent(mHostContext, intent);
    } catch (Exception e) {
        if (DEBUG) {
            e.printStackTrace();
        }
    }

    return mTarget.startActivity(caller, callingPackage, intent, resolvedType, resultTo, resultWho,
            requestCode, flags, profileFile, profileFd, options);
}
 
Example #19
Source File: ClientTransaction.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/** Obtain an instance initialized with provided params. */
public static ClientTransaction obtain(IApplicationThread client, IBinder activityToken) {
    ClientTransaction instance = ObjectPool.obtain(ClientTransaction.class);
    if (instance == null) {
        instance = new ClientTransaction();
    }
    instance.mClient = client;
    instance.mActivityToken = activityToken;

    return instance;
}
 
Example #20
Source File: ActivityManagerNativeWorker.java    From GPT with Apache License 2.0 5 votes vote down vote up
public int startActivity(IApplicationThread caller, Intent intent, String resolvedType,
                         Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode,
                         boolean onlyIfNeeded, boolean debug, String profileFile, ParcelFileDescriptor profileFd,
                         boolean autoStopProfiler) {

    RemapingUtil.remapActivityIntent(mHostContext, intent);

    return mTarget.startActivity(caller, intent, resolvedType, grantedUriPermissions, grantedMode, resultTo,
            resultWho, requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
}
 
Example #21
Source File: ActivityManagerProxy.java    From VirtualAPK with Apache License 2.0 5 votes vote down vote up
protected Object startService(Object proxy, Method method, Object[] args) throws Throwable {
    IApplicationThread appThread = (IApplicationThread) args[0];
    Intent target = (Intent) args[1];
    ResolveInfo resolveInfo = this.mPluginManager.resolveService(target, 0);
    if (null == resolveInfo || null == resolveInfo.serviceInfo) {
        // is host service
        return method.invoke(this.mActivityManager, args);
    }

    return startDelegateServiceForTarget(target, resolveInfo.serviceInfo, null, RemoteService.EXTRA_COMMAND_START_SERVICE);
}
 
Example #22
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public final int startActivity(IApplicationThread caller, String callingPackage,
                               Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode,
                               int startFlags, ProfilerInfo profilerInfo, Bundle bOptions) {
    return PreventRunningUtils.onStartActivity(
            startActivity$Pr(caller, callingPackage,
                    intent, resolvedType, resultTo, resultWho, requestCode,
                    startFlags, profilerInfo, bOptions),
            caller, callingPackage, intent);
}
 
Example #23
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public final int startActivity(IApplicationThread caller, String callingPackage,
                               Intent intent, String resolvedType, IBinder resultTo,
                               String resultWho, int requestCode, int startFlags,
                               String profileFile, ParcelFileDescriptor profileFd, Bundle options) {
    return PreventRunningUtils.onStartActivity(
            startActivity$Pr(caller, callingPackage,
                    intent, resolvedType, resultTo,
                    resultWho, requestCode, startFlags,
                    profileFile, profileFd, options),
            caller, callingPackage, intent);
}
 
Example #24
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public ComponentName startService(IApplicationThread caller, Intent service,
                                  String resolvedType, String callingPackage, int userId)
        throws TransactionTooLargeException {
    try {
        PreventRunningUtils.setSender(caller);
        if (PreventRunningUtils.hookStartService(caller, service)) {
            return startService$Pr(caller, service, resolvedType, callingPackage, userId);
        }
        return null;
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #25
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public ComponentName startService(IApplicationThread caller, Intent service,
                                  String resolvedType, int userId) {
    try {
        PreventRunningUtils.setSender(caller);
        if (PreventRunningUtils.hookStartService(caller, service)) {
            return startService$Pr(caller, service, resolvedType, userId);
        }
        return null;
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #26
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public int bindService(IApplicationThread caller, IBinder token, Intent service,
                       String resolvedType, IServiceConnection connection, int flags, String callingPackage,
                       int userId) throws TransactionTooLargeException {
    try {
        PreventRunningUtils.setSender(caller);
        if (PreventRunningUtils.hookBindService(caller, token, service)) {
            return bindService$Pr(caller, token, service,
                    resolvedType, connection, flags, callingPackage, userId);
        } else {
            return 0;
        }
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #27
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public int bindService(IApplicationThread caller, IBinder token,
                       Intent service, String resolvedType,
                       IServiceConnection connection, int flags, int userId) {
    try {
        PreventRunningUtils.setSender(caller);
        if (PreventRunningUtils.hookBindService(caller, token, service)) {
            return bindService$Pr(caller, token, service,
                    resolvedType, connection, flags, userId);
        } else {
            return 0;
        }
    } finally {
        PreventRunningUtils.clearSender();
    }
}
 
Example #28
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public final int startActivity$Pr(IApplicationThread caller, String callingPackage,
                                  Intent intent, String resolvedType, IBinder resultTo,
                                  String resultWho, int requestCode, int startFlags,
                                  String profileFile, ParcelFileDescriptor profileFd, Bundle options) {

    throw new UnsupportedOperationException();
}
 
Example #29
Source File: ActivityManagerService.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public final int broadcastIntent$Pr(IApplicationThread caller,
                                    Intent intent, String resolvedType, IIntentReceiver resultTo,
                                    int resultCode, String resultData, Bundle resultExtras,
                                    String[] requiredPermissions, int appOp, Bundle bOptions,
                                    boolean serialized, boolean sticky, int userId) {
    throw new UnsupportedOperationException();
}
 
Example #30
Source File: PreventRunningUtils.java    From prevent with Do What The F*ck You Want To Public License 5 votes vote down vote up
public static int onStartActivity(int res, IApplicationThread caller, String callingPackage, Intent intent) {
    if (res >= 0 && intent != null && (intent.hasCategory(Intent.CATEGORY_HOME) || intent.hasCategory(Intent.CATEGORY_LAUNCHER))) {
        ProcessRecord callerApp = getAms().getRecordForAppLocked(caller);
        if (callerApp != null) {
            mPreventRunning.onStartHomeActivity(callerApp.info.packageName);
        }
    }
    return res;
}