Search in sources :

Example 51 with RemoteException

use of android.os.RemoteException in project platform_frameworks_base by android.

the class WallpaperBackupAgent method servicePackageExists.

private boolean servicePackageExists(ComponentName comp) {
    try {
        if (comp != null) {
            final IPackageManager pm = AppGlobals.getPackageManager();
            final PackageInfo info = pm.getPackageInfo(comp.getPackageName(), 0, UserHandle.USER_SYSTEM);
            return (info != null);
        }
    } catch (RemoteException e) {
        Slog.e(TAG, "Unable to contact package manager");
    }
    return false;
}
Also used : IPackageManager(android.content.pm.IPackageManager) PackageInfo(android.content.pm.PackageInfo) RemoteException(android.os.RemoteException)

Example 52 with RemoteException

use of android.os.RemoteException in project platform_frameworks_base by android.

the class WapPushTest method testDeletePackage1.

/**
     * Deleting package test
     */
public void testDeletePackage1() {
    int originalAppIdValue = mAppIdValue;
    int originalContentTypeValue = mContentTypeValue;
    // set up data
    try {
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mAppIdValue += 10;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mContentTypeValue += 20;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
        mContentTypeValue += 20;
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, 0, false, false);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
    utDeletePackage();
    mAppIdValue += 10;
    utDeletePackage();
    mContentTypeValue += 20;
    utDeletePackage();
    mContentTypeValue += 20;
    utDeletePackage();
    mAppIdValue = originalAppIdValue;
    mContentTypeValue = originalContentTypeValue;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 53 with RemoteException

use of android.os.RemoteException in project platform_frameworks_base by android.

the class WapPushTest method testProcessMsg1.

/**
     * Message processing test, start activity
     */
public void testProcessMsg1() {
    byte[] pdu = createPDU(1);
    int headerLen = pdu.length - (mGsmHeader.length + mUserDataHeader.length + mMessageBody.length);
    int pduType = 6;
    int tranId = 0;
    String originalPackageName = mPackageName;
    String originalClassName = mClassName;
    try {
        mClassName = "com.android.smspush.unitTests.ReceiverActivity";
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_ACTIVITY, false, false);
        assertTrue((iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId)) & WapPushManagerParams.MESSAGE_HANDLED) == WapPushManagerParams.MESSAGE_HANDLED);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 54 with RemoteException

use of android.os.RemoteException in project platform_frameworks_base by android.

the class WapPushTest method testProcessMsg3.

/**
     * Message processing test, no signature
     */
public void testProcessMsg3() {
    byte[] pdu = createPDU(1);
    int headerLen = pdu.length - (mGsmHeader.length + mUserDataHeader.length + mMessageBody.length);
    int pduType = 6;
    int tranId = 0;
    String originalPackageName = mPackageName;
    String originalClassName = mClassName;
    try {
        mPackageName = "com.android.development";
        mClassName = "com.android.development.Development";
        // set up data
        IWapPushManager iwapman = getInterface();
        iwapman.addPackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, true, false);
        assertFalse((iwapman.processMessage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), createIntent(pduType, tranId)) & WapPushManagerParams.MESSAGE_HANDLED) == WapPushManagerParams.MESSAGE_HANDLED);
        // clean up data
        iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName);
    } catch (RemoteException e) {
        assertTrue(false);
    }
    mPackageName = originalPackageName;
    mClassName = originalClassName;
}
Also used : IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Example 55 with RemoteException

use of android.os.RemoteException in project platform_frameworks_base by android.

the class WapPushTest method utDeletePackage.

protected void utDeletePackage() {
    IWapPushManager iwapman = getInterface();
    try {
        assertTrue(iwapman.deletePackage(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName));
    } catch (RemoteException e) {
        assertTrue(false);
    }
    // verify the data
    WapPushManager wpman = getService();
    assertTrue(!wpman.isDataExist(Integer.toString(mAppIdValue), Integer.toString(mContentTypeValue), mPackageName, mClassName));
}
Also used : WapPushManager(com.android.smspush.WapPushManager) IWapPushManager(com.android.internal.telephony.IWapPushManager) IWapPushManager(com.android.internal.telephony.IWapPushManager) RemoteException(android.os.RemoteException)

Aggregations

RemoteException (android.os.RemoteException)4527 Intent (android.content.Intent)595 IBinder (android.os.IBinder)480 Bundle (android.os.Bundle)461 Point (android.graphics.Point)423 IOException (java.io.IOException)381 PendingIntent (android.app.PendingIntent)274 ComponentName (android.content.ComponentName)265 ArrayList (java.util.ArrayList)248 ApplicationInfo (android.content.pm.ApplicationInfo)190 IPackageManager (android.content.pm.IPackageManager)190 Message (android.os.Message)184 Uri (android.net.Uri)157 UserHandle (android.os.UserHandle)154 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)151 Cursor (android.database.Cursor)150 Configuration (android.content.res.Configuration)133 UserInfo (android.content.pm.UserInfo)129 AndroidRuntimeException (android.util.AndroidRuntimeException)128 ParcelFileDescriptor (android.os.ParcelFileDescriptor)126