RK android13静默安装和静默卸载

package com.android.server.features;

import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInstaller;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.provider.Settings;
import android.content.ComponentName;

/**
 * 应用管理类
 *
 */

public class ApkManager {
    private static final String TAG = "ApkManager";

    private static ApkManager INSTANCE = null;
    Context mContext;
    private ApkManager() {
    };

    public static synchronized ApkManager getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new ApkManager();
        }
        return(INSTANCE);
    }
    /**
     * 静默卸载
     * @param context
     * @param packageName
     */
    public  void silentUninstall(Context context,String unInstallPackageName){
        PackageInstaller mPackageInstaller = context.getPackageManager().getPackageInstaller();
    
         //Intent intent = new Intent(context, cls);
         Intent intent = new Intent();
        //intent.setComponent( new ComponentName(packageName, className));
    intent.addFlags(0x01000000);
        intent.s

你可能感兴趣的:(android)