缓存可以通过 AIDL 清理,forcestop 功能呢?
我试过了,但失败了。以前有人这样做过吗?
在我的包中添加aidl文件:
IActivityManager.aidl
package android.app;
oneway interface IActivityManager {
void forceStopPackage(String packageName);
}
实现 IActivityManager,但我无法获取它的对象:
import android.app.IActivityManager;
class ActivityManagerProxy implements IActivityManager
{
public ActivityManagerProxy(IBinder remote)
{
mRemote = remote;
}
public IBinder asBinder()
{
return mRemote;
}
public void forceStopPackage(String packageName) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(descriptor);
data.writeString(packageName);
mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();
reply.recycle();
}
private IBinder mRemote;
}