android.content.pm.IPackageDeleteObserver Java Examples

The following examples show how to use android.content.pm.IPackageDeleteObserver. 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 Project: product-emm   Author: wso2-attic   File: AppUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Silently uninstalls the app resides in the provided URI.
 * @param context - Application context.
 * @param  packageName - App package name.
 */
public static void silentUninstallApp(Context context, String packageName) {
    if (packageName != null && packageName.contains(PACKAGE_PREFIX)) {
        packageName = packageName.replace(PACKAGE_PREFIX, "");
    }
    final String _packageName = packageName;
    PackageManager pm = context.getPackageManager();
    IPackageDeleteObserver observer = new IPackageDeleteObserver() {
        @Override
        public void packageDeleted(String s, int i) throws RemoteException {
            Log.d(TAG, _packageName + " deleted successfully.");
        }

        @Override
        public IBinder asBinder() {
            return null;
        }
    };
    pm.deletePackage(packageName, observer, DELETE_ALL_USERS);
}
 
Example #2
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags,
        int userId) {
    try {
        mPM.deletePackageAsUser(packageName, observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #3
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #4
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    try {
        mPM.deletePackageAsUser(packageName, observer, UserHandle.myUserId(), flags);
    } catch (RemoteException e) {
        // Should never happen!
    }
}
 
Example #5
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #6
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #7
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    try {
        mPM.deletePackage(packageName, observer, flags);
    } catch (RemoteException e) {
        // Should never happen!
    }
}
 
Example #8
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    try {
        mPM.deletePackageAsUser(packageName, observer, UserHandle.myUserId(), flags);
    } catch (RemoteException e) {
        // Should never happen!
    }
}
 
Example #9
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #10
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #11
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags,
        int userId) {
    try {
        mPM.deletePackageAsUser(packageName, observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #12
Source Project: android_9.0.0_r45   Author: lulululbj   File: ApplicationPackageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer,
        int flags, int userId) {
    try {
        mPM.deletePackageAsUser(packageName, PackageManager.VERSION_CODE_HIGHEST,
                observer, userId, flags);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example #13
Source Project: Demo_Public   Author: coderminer   File: ApplicationManager.java    License: MIT License 5 votes vote down vote up
public ApplicationManager(Context context) throws SecurityException, NoSuchMethodException {
	
       observer = new PackageInstallObserver();
       observerdelete = new PackageDeleteObserver(); 
       pm = context.getPackageManager();
       
       Class<?>[] types = new Class[] {Uri.class, IPackageInstallObserver.class, int.class, String.class};
       Class<?>[] uninstalltypes = new Class[] {String.class, IPackageDeleteObserver.class, int.class};
       
	method = pm.getClass().getMethod("installPackage", types);
	uninstallmethod = pm.getClass().getMethod("deletePackage", uninstalltypes);
}
 
Example #14
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #15
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #16
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #17
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #18
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #19
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@UnsupportedAppUsage
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, getUserId());
}
 
Example #20
Source Project: AndroidComponentPlugin   Author: androidmalin   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #21
Source Project: android_9.0.0_r45   Author: lulululbj   File: ApplicationPackageManager.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
    deletePackageAsUser(packageName, observer, flags, mContext.getUserId());
}
 
Example #22
Source Project: MiPushFramework   Author: MiPushFramework   File: PackageManagerWrapper.java    License: GNU General Public License v3.0 4 votes vote down vote up
/** @hide */
@Override public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) {
	mBase.deletePackage(packageName, observer, flags);
}
 
Example #23
Source Project: MiPushFramework   Author: MiPushFramework   File: PackageManagerWrapper.java    License: GNU General Public License v3.0 4 votes vote down vote up
/** @hide */
@RequiresPermission(Manifest.permission.DELETE_PACKAGES)
@Override public void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags, int userId) {
	mBase.deletePackageAsUser(packageName, observer, flags, userId);
}