Merge "Call PermissionEnforcer helper methods"
This commit is contained in:
@@ -77,6 +77,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean startInstallation(String dsuSlot) throws RemoteException {
|
public boolean startInstallation(String dsuSlot) throws RemoteException {
|
||||||
|
super.startInstallation_enforcePermission();
|
||||||
|
|
||||||
IGsiService service = getGsiService();
|
IGsiService service = getGsiService();
|
||||||
mGsiService = service;
|
mGsiService = service;
|
||||||
// priority from high to low: sysprop -> sdcard -> /data
|
// priority from high to low: sysprop -> sdcard -> /data
|
||||||
@@ -124,6 +126,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public int createPartition(String name, long size, boolean readOnly) throws RemoteException {
|
public int createPartition(String name, long size, boolean readOnly) throws RemoteException {
|
||||||
|
super.createPartition_enforcePermission();
|
||||||
|
|
||||||
IGsiService service = getGsiService();
|
IGsiService service = getGsiService();
|
||||||
int status = service.createPartition(name, size, readOnly);
|
int status = service.createPartition(name, size, readOnly);
|
||||||
if (status != IGsiService.INSTALL_OK) {
|
if (status != IGsiService.INSTALL_OK) {
|
||||||
@@ -135,6 +139,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean closePartition() throws RemoteException {
|
public boolean closePartition() throws RemoteException {
|
||||||
|
super.closePartition_enforcePermission();
|
||||||
|
|
||||||
IGsiService service = getGsiService();
|
IGsiService service = getGsiService();
|
||||||
if (service.closePartition() != 0) {
|
if (service.closePartition() != 0) {
|
||||||
Slog.i(TAG, "Partition installation completes with error");
|
Slog.i(TAG, "Partition installation completes with error");
|
||||||
@@ -146,6 +152,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean finishInstallation() throws RemoteException {
|
public boolean finishInstallation() throws RemoteException {
|
||||||
|
super.finishInstallation_enforcePermission();
|
||||||
|
|
||||||
IGsiService service = getGsiService();
|
IGsiService service = getGsiService();
|
||||||
if (service.closeInstall() != 0) {
|
if (service.closeInstall() != 0) {
|
||||||
Slog.i(TAG, "Failed to finish installation");
|
Slog.i(TAG, "Failed to finish installation");
|
||||||
@@ -157,12 +165,16 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public GsiProgress getInstallationProgress() throws RemoteException {
|
public GsiProgress getInstallationProgress() throws RemoteException {
|
||||||
|
super.getInstallationProgress_enforcePermission();
|
||||||
|
|
||||||
return getGsiService().getInstallProgress();
|
return getGsiService().getInstallProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean abort() throws RemoteException {
|
public boolean abort() throws RemoteException {
|
||||||
|
super.abort_enforcePermission();
|
||||||
|
|
||||||
return getGsiService().cancelGsiInstall();
|
return getGsiService().cancelGsiInstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,12 +195,16 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean isEnabled() throws RemoteException {
|
public boolean isEnabled() throws RemoteException {
|
||||||
|
super.isEnabled_enforcePermission();
|
||||||
|
|
||||||
return getGsiService().isGsiEnabled();
|
return getGsiService().isGsiEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean remove() throws RemoteException {
|
public boolean remove() throws RemoteException {
|
||||||
|
super.remove_enforcePermission();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GsiServiceCallback callback = new GsiServiceCallback();
|
GsiServiceCallback callback = new GsiServiceCallback();
|
||||||
synchronized (callback) {
|
synchronized (callback) {
|
||||||
@@ -205,6 +221,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean setEnable(boolean enable, boolean oneShot) throws RemoteException {
|
public boolean setEnable(boolean enable, boolean oneShot) throws RemoteException {
|
||||||
|
super.setEnable_enforcePermission();
|
||||||
|
|
||||||
IGsiService gsiService = getGsiService();
|
IGsiService gsiService = getGsiService();
|
||||||
if (enable) {
|
if (enable) {
|
||||||
try {
|
try {
|
||||||
@@ -229,6 +247,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean setAshmem(ParcelFileDescriptor ashmem, long size) {
|
public boolean setAshmem(ParcelFileDescriptor ashmem, long size) {
|
||||||
|
super.setAshmem_enforcePermission();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getGsiService().setGsiAshmem(ashmem, size);
|
return getGsiService().setGsiAshmem(ashmem, size);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -239,6 +259,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean submitFromAshmem(long size) {
|
public boolean submitFromAshmem(long size) {
|
||||||
|
super.submitFromAshmem_enforcePermission();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getGsiService().commitGsiChunkFromAshmem(size);
|
return getGsiService().commitGsiChunkFromAshmem(size);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -249,6 +271,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public boolean getAvbPublicKey(AvbPublicKey dst) {
|
public boolean getAvbPublicKey(AvbPublicKey dst) {
|
||||||
|
super.getAvbPublicKey_enforcePermission();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getGsiService().getAvbPublicKey(dst) == 0;
|
return getGsiService().getAvbPublicKey(dst) == 0;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -259,6 +283,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
@EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
|
||||||
public long suggestScratchSize() throws RemoteException {
|
public long suggestScratchSize() throws RemoteException {
|
||||||
|
super.suggestScratchSize_enforcePermission();
|
||||||
|
|
||||||
return getGsiService().suggestScratchSize();
|
return getGsiService().suggestScratchSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public class SerialService extends ISerialManager.Stub {
|
|||||||
|
|
||||||
@EnforcePermission(android.Manifest.permission.SERIAL_PORT)
|
@EnforcePermission(android.Manifest.permission.SERIAL_PORT)
|
||||||
public String[] getSerialPorts() {
|
public String[] getSerialPorts() {
|
||||||
|
super.getSerialPorts_enforcePermission();
|
||||||
|
|
||||||
ArrayList<String> ports = new ArrayList<String>();
|
ArrayList<String> ports = new ArrayList<String>();
|
||||||
for (int i = 0; i < mSerialPorts.length; i++) {
|
for (int i = 0; i < mSerialPorts.length; i++) {
|
||||||
String path = mSerialPorts[i];
|
String path = mSerialPorts[i];
|
||||||
@@ -51,6 +53,8 @@ public class SerialService extends ISerialManager.Stub {
|
|||||||
|
|
||||||
@EnforcePermission(android.Manifest.permission.SERIAL_PORT)
|
@EnforcePermission(android.Manifest.permission.SERIAL_PORT)
|
||||||
public ParcelFileDescriptor openSerialPort(String path) {
|
public ParcelFileDescriptor openSerialPort(String path) {
|
||||||
|
super.openSerialPort_enforcePermission();
|
||||||
|
|
||||||
for (int i = 0; i < mSerialPorts.length; i++) {
|
for (int i = 0; i < mSerialPorts.length; i++) {
|
||||||
if (mSerialPorts[i].equals(path)) {
|
if (mSerialPorts[i].equals(path)) {
|
||||||
return native_open(path);
|
return native_open(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user