Search in sources :

Example 41 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class CompatModePackages method handlePackageAddedLocked.

public void handlePackageAddedLocked(String packageName, boolean updated) {
    ApplicationInfo ai = null;
    try {
        ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0, 0);
    } catch (RemoteException e) {
    }
    if (ai == null) {
        return;
    }
    CompatibilityInfo ci = compatibilityInfoForPackageLocked(ai);
    final boolean mayCompat = !ci.alwaysSupportsScreen() && !ci.neverSupportsScreen();
    if (updated) {
        // any current settings for it.
        if (!mayCompat && mPackages.containsKey(packageName)) {
            mPackages.remove(packageName);
            mHandler.removeMessages(MSG_WRITE);
            Message msg = mHandler.obtainMessage(MSG_WRITE);
            mHandler.sendMessageDelayed(msg, 10000);
        }
    }
}
Also used : Message(android.os.Message) ApplicationInfo(android.content.pm.ApplicationInfo) CompatibilityInfo(android.content.res.CompatibilityInfo) RemoteException(android.os.RemoteException)

Example 42 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class Nat464Xlat method interfaceAdded.

@Override
public void interfaceAdded(String iface) {
    if (iface.equals(CLAT_INTERFACE_NAME)) {
        Slog.i(TAG, "interface " + CLAT_INTERFACE_NAME + " added, mIsRunning = " + mIsRunning + " -> true");
        mIsRunning = true;
        // it's running on.
        try {
            InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
            mLP.clear();
            mLP.setInterfaceName(iface);
            RouteInfo ipv4Default = new RouteInfo(new LinkAddress(Inet4Address.ANY, 0), null, iface);
            mLP.addRoute(ipv4Default);
            mLP.addLinkAddress(config.getLinkAddress());
            mTracker.addStackedLink(mLP);
            Slog.i(TAG, "Adding stacked link. tracker LP: " + mTracker.getLinkProperties());
        } catch (RemoteException e) {
            Slog.e(TAG, "Error getting link properties: " + e);
        }
        // Inform ConnectivityService that things have changed.
        Message msg = mHandler.obtainMessage(NetworkStateTracker.EVENT_CONFIGURATION_CHANGED, mTracker.getNetworkInfo());
        Slog.i(TAG, "sending message to ConnectivityService: " + msg);
        msg.sendToTarget();
    }
}
Also used : LinkAddress(android.net.LinkAddress) Message(android.os.Message) RouteInfo(android.net.RouteInfo) RemoteException(android.os.RemoteException) InterfaceConfiguration(android.net.InterfaceConfiguration)

Example 43 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class ActivityManagerService method handleApplicationStrictModeViolation.

public void handleApplicationStrictModeViolation(IBinder app, int violationMask, StrictMode.ViolationInfo info) {
    ProcessRecord r = findAppProcess(app, "StrictMode");
    if (r == null) {
        return;
    }
    if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
        Integer stackFingerprint = info.hashCode();
        boolean logIt = true;
        synchronized (mAlreadyLoggedViolatedStacks) {
            if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {
                logIt = false;
            // TODO: sub-sample into EventLog for these, with
            // the info.durationMillis?  Then we'd get
            // the relative pain numbers, without logging all
            // the stack traces repeatedly.  We'd want to do
            // likewise in the client code, which also does
            // dup suppression, before the Binder call.
            } else {
                if (mAlreadyLoggedViolatedStacks.size() >= MAX_DUP_SUPPRESSED_STACKS) {
                    mAlreadyLoggedViolatedStacks.clear();
                }
                mAlreadyLoggedViolatedStacks.add(stackFingerprint);
            }
        }
        if (logIt) {
            logStrictModeViolationToDropBox(r, info);
        }
    }
    if ((violationMask & StrictMode.PENALTY_DIALOG) != 0) {
        AppErrorResult result = new AppErrorResult();
        synchronized (this) {
            final long origId = Binder.clearCallingIdentity();
            Message msg = Message.obtain();
            msg.what = SHOW_STRICT_MODE_VIOLATION_MSG;
            HashMap<String, Object> data = new HashMap<String, Object>();
            data.put("result", result);
            data.put("app", r);
            data.put("violationMask", violationMask);
            data.put("info", info);
            msg.obj = data;
            mHandler.sendMessage(msg);
            Binder.restoreCallingIdentity(origId);
        }
        int res = result.get();
        Slog.w(TAG, "handleApplicationStrictModeViolation; res=" + res);
    }
}
Also used : Message(android.os.Message) HashMap(java.util.HashMap)

Example 44 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class ActivityManagerService method killApplicationWithAppId.

/*
     * The pkg name and app id have to be specified.
     */
public void killApplicationWithAppId(String pkg, int appid) {
    if (pkg == null) {
        return;
    }
    // Make sure the uid is valid.
    if (appid < 0) {
        Slog.w(TAG, "Invalid appid specified for pkg : " + pkg);
        return;
    }
    int callerUid = Binder.getCallingUid();
    // Only the system server can kill an application
    if (callerUid == Process.SYSTEM_UID) {
        // Post an aysnc message to kill the application
        Message msg = mHandler.obtainMessage(KILL_APPLICATION_MSG);
        msg.arg1 = appid;
        msg.arg2 = 0;
        msg.obj = pkg;
        mHandler.sendMessage(msg);
    } else {
        throw new SecurityException(callerUid + " cannot kill pkg: " + pkg);
    }
}
Also used : Message(android.os.Message)

Example 45 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class ActivityStack method scheduleIdleLocked.

final void scheduleIdleLocked() {
    Message msg = Message.obtain();
    msg.what = IDLE_NOW_MSG;
    mHandler.sendMessage(msg);
}
Also used : Message(android.os.Message)

Aggregations

Message (android.os.Message)3198 Handler (android.os.Handler)347 RemoteException (android.os.RemoteException)263 Bundle (android.os.Bundle)210 Test (org.junit.Test)144 Intent (android.content.Intent)130 IOException (java.io.IOException)124 Point (android.graphics.Point)86 HashMap (java.util.HashMap)77 SomeArgs (com.android.internal.os.SomeArgs)67 SmallTest (android.test.suitebuilder.annotation.SmallTest)64 Messenger (android.os.Messenger)63 ArrayList (java.util.ArrayList)59 View (android.view.View)52 File (java.io.File)50 MediumTest (android.test.suitebuilder.annotation.MediumTest)43 TextView (android.widget.TextView)41 IBinder (android.os.IBinder)38 Map (java.util.Map)37 PendingIntent (android.app.PendingIntent)33