com.android.internal.os.RuntimeInit Java Examples
The following examples show how to use
com.android.internal.os.RuntimeInit.
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: StrictMode.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static void handleApplicationStrictModeViolation(int violationMaskSubset, ViolationInfo info) { final int oldMask = getThreadPolicyMask(); try { // First, remove any policy before we call into the Activity Manager, // otherwise we'll infinite recurse as we try to log policy violations // to disk, thus violating policy, thus requiring logging, etc... // We restore the current policy below, in the finally block. setThreadPolicyMask(0); IActivityManager am = ActivityManager.getService(); if (am == null) { Log.w(TAG, "No activity manager; failed to Dropbox violation."); } else { am.handleApplicationStrictModeViolation( RuntimeInit.getApplicationObject(), violationMaskSubset, info); } } catch (RemoteException e) { if (e instanceof DeadObjectException) { // System process is dead; ignore } else { Log.e(TAG, "RemoteException handling StrictMode violation", e); } } finally { setThreadPolicyMask(oldMask); } }
Example #2
Source File: XposedBridge.java From xposed-art with Apache License 2.0 | 5 votes |
/** * Called when native methods and other things are initialized, but before preloading classes etc. */ private static void main(String[] args) { // the class the VM has been created for or null for the Zygote process String startClassName = getStartClassName(); try { log("Loading Xposed (for " + (startClassName == null ? "Zygote" : startClassName) + ")..."); if (startClassName == null) { // Zygote log("Running ROM '" + Build.DISPLAY + "' with fingerprint '" + Build.FINGERPRINT + "'"); } if (initNative()) { if (startClassName == null) { // Initializations for Zygote initXbridgeZygote(); } loadModules(startClassName); } else { log("Errors during native Xposed initialization"); } } catch (Throwable t) { log("Errors during Xposed initialization"); log(t); } // call the original startup code if (startClassName == null) { log("xposed: calling ZygoteInit"); ZygoteInit.main(args); } else { log("xposed: calling RuntimeInit"); RuntimeInit.main(args); } }
Example #3
Source File: ActivityThread.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private void attach(boolean system) { sThreadLocal.set(this); mSystemThread = system; if (!system) { ViewRootImpl.addFirstDrawHandler(new Runnable() { public void run() { ensureJitEnabled(); } }); android.ddm.DdmHandleAppName.setAppName("<pre-initialized>"); RuntimeInit.setApplicationObject(mAppThread.asBinder()); IActivityManager mgr = ActivityManagerNative.getDefault(); try { mgr.attachApplication(mAppThread); } catch (RemoteException ex) { // Ignore } } else { // Don't set application object here -- if the system crashes, // we can't display an alert, we just want to die die die. android.ddm.DdmHandleAppName.setAppName("system_process"); try { mInstrumentation = new Instrumentation(); ContextImpl context = new ContextImpl(); context.init(getSystemContext().mPackageInfo, null, this); Application app = Instrumentation.newApplication(Application.class, context); mAllApplications.add(app); mInitialApplication = app; app.onCreate(); } catch (Exception e) { throw new RuntimeException( "Unable to instantiate Application():" + e.toString(), e); } } ViewRootImpl.addConfigCallback(new ComponentCallbacks2() { public void onConfigurationChanged(Configuration newConfig) { synchronized (mPackages) { // We need to apply this change to the resources // immediately, because upon returning the view // hierarchy will be informed about it. if (applyConfigurationToResourcesLocked(newConfig, null)) { // This actually changed the resources! Tell // everyone about it. if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) { mPendingConfiguration = newConfig; queueOrSendMessage(H.CONFIGURATION_CHANGED, newConfig); } } } } public void onLowMemory() { } public void onTrimMemory(int level) { } }); }
Example #4
Source File: ActivityThread.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private void attach(boolean system) { sThreadLocal.set(this); mSystemThread = system; if (!system) { ViewRootImpl.addFirstDrawHandler(new Runnable() { public void run() { ensureJitEnabled(); } }); android.ddm.DdmHandleAppName.setAppName("<pre-initialized>"); RuntimeInit.setApplicationObject(mAppThread.asBinder()); IActivityManager mgr = ActivityManagerNative.getDefault(); try { mgr.attachApplication(mAppThread); } catch (RemoteException ex) { // Ignore } } else { // Don't set application object here -- if the system crashes, // we can't display an alert, we just want to die die die. android.ddm.DdmHandleAppName.setAppName("system_process"); try { mInstrumentation = new Instrumentation(); ContextImpl context = new ContextImpl(); context.init(getSystemContext().mPackageInfo, null, this); Application app = Instrumentation.newApplication(Application.class, context); mAllApplications.add(app); mInitialApplication = app; app.onCreate(); } catch (Exception e) { throw new RuntimeException( "Unable to instantiate Application():" + e.toString(), e); } } ViewRootImpl.addConfigCallback(new ComponentCallbacks2() { public void onConfigurationChanged(Configuration newConfig) { synchronized (mPackages) { // We need to apply this change to the resources // immediately, because upon returning the view // hierarchy will be informed about it. if (applyConfigurationToResourcesLocked(newConfig, null)) { // This actually changed the resources! Tell // everyone about it. if (mPendingConfiguration == null || mPendingConfiguration.isOtherSeqNewer(newConfig)) { mPendingConfiguration = newConfig; queueOrSendMessage(H.CONFIGURATION_CHANGED, newConfig); } } } } public void onLowMemory() { } public void onTrimMemory(int level) { } }); }
Example #5
Source File: Log.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public void onTerribleFailure(String tag, TerribleFailure what, boolean system) { RuntimeInit.wtf(tag, what, system); }