Fix resource code and version attributes
Create a new package setting object for updated system apps rather than moving around the same setting. This updates the resource, code and version correctly. For updating system packages, disable the package first which removes the entry from internal structures, create a new package setting, add it to list of user id's then rest of installation steps, kill the process if needed via ActivityManager then add this setting if everything was successful. This also fixes issues with updating values prematurely. When a new version of system package is available via OTA, just physically remove entries for pkg. Note that the component and other info will be eventually updated later on when scanning the package. Also move certificate verification slightly ahead before scanning packages. Some null checks New api's in ActivityManager to kill an application pkg before finishing installation
This commit is contained in:
@@ -1085,6 +1085,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
reply.writeInt(result);
|
||||
return true;
|
||||
}
|
||||
case KILL_APPLICATION_WITH_UID_TRANSACTION: {
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
String pkg = data.readString();
|
||||
int uid = data.readInt();
|
||||
killApplicationWithUid(pkg, uid);
|
||||
reply.writeNoException();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTransact(code, data, reply, flags);
|
||||
@@ -2368,6 +2376,17 @@ class ActivityManagerProxy implements IActivityManager
|
||||
data.recycle();
|
||||
return result;
|
||||
}
|
||||
public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
data.writeString(pkg);
|
||||
data.writeInt(uid);
|
||||
mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
data.recycle();
|
||||
reply.recycle();
|
||||
}
|
||||
|
||||
private IBinder mRemote;
|
||||
}
|
||||
|
||||
@@ -266,6 +266,8 @@ public interface IActivityManager extends IInterface {
|
||||
Intent intent, String resolvedType, IBinder resultTo,
|
||||
String resultWho, int requestCode, boolean onlyIfNeeded)
|
||||
throws RemoteException;
|
||||
|
||||
public void killApplicationWithUid(String pkg, int uid) throws RemoteException;
|
||||
|
||||
/*
|
||||
* Private non-Binder interfaces
|
||||
@@ -421,4 +423,5 @@ public interface IActivityManager extends IInterface {
|
||||
int REGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92;
|
||||
int UNREGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93;
|
||||
int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94;
|
||||
int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user