Merge "Keystore 2.0: Renaming the vpnstore interface." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3f0c227d93
@@ -103,9 +103,9 @@ filegroup {
|
|||||||
":android.hardware.security.secureclock-V1-java-source",
|
":android.hardware.security.secureclock-V1-java-source",
|
||||||
":android.security.apc-java-source",
|
":android.security.apc-java-source",
|
||||||
":android.security.authorization-java-source",
|
":android.security.authorization-java-source",
|
||||||
|
":android.security.legacykeystore-java-source",
|
||||||
":android.security.maintenance-java-source",
|
":android.security.maintenance-java-source",
|
||||||
":android.security.metrics-java-source",
|
":android.security.metrics-java-source",
|
||||||
":android.security.vpnprofilestore-java-source",
|
|
||||||
":android.system.keystore2-V1-java-source",
|
":android.system.keystore2-V1-java-source",
|
||||||
":credstore_aidl",
|
":credstore_aidl",
|
||||||
":dumpstate_aidl",
|
":dumpstate_aidl",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package android.security;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.ServiceSpecificException;
|
import android.os.ServiceSpecificException;
|
||||||
import android.security.vpnprofilestore.IVpnProfileStore;
|
import android.security.legacykeystore.ILegacyKeystore;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,14 +32,14 @@ import android.util.Log;
|
|||||||
public class LegacyVpnProfileStore {
|
public class LegacyVpnProfileStore {
|
||||||
private static final String TAG = "LegacyVpnProfileStore";
|
private static final String TAG = "LegacyVpnProfileStore";
|
||||||
|
|
||||||
public static final int SYSTEM_ERROR = IVpnProfileStore.ERROR_SYSTEM_ERROR;
|
public static final int SYSTEM_ERROR = ILegacyKeystore.ERROR_SYSTEM_ERROR;
|
||||||
public static final int PROFILE_NOT_FOUND = IVpnProfileStore.ERROR_PROFILE_NOT_FOUND;
|
public static final int PROFILE_NOT_FOUND = ILegacyKeystore.ERROR_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
private static final String VPN_PROFILE_STORE_SERVICE_NAME = "android.security.vpnprofilestore";
|
private static final String LEGACY_KEYSTORE_SERVICE_NAME = "android.security.legacykeystore";
|
||||||
|
|
||||||
private static IVpnProfileStore getService() {
|
private static ILegacyKeystore getService() {
|
||||||
return IVpnProfileStore.Stub.asInterface(
|
return ILegacyKeystore.Stub.asInterface(
|
||||||
ServiceManager.checkService(VPN_PROFILE_STORE_SERVICE_NAME));
|
ServiceManager.checkService(LEGACY_KEYSTORE_SERVICE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +52,7 @@ public class LegacyVpnProfileStore {
|
|||||||
*/
|
*/
|
||||||
public static boolean put(@NonNull String alias, @NonNull byte[] profile) {
|
public static boolean put(@NonNull String alias, @NonNull byte[] profile) {
|
||||||
try {
|
try {
|
||||||
getService().put(alias, profile);
|
getService().put(alias, ILegacyKeystore.UID_SELF, profile);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Failed to put vpn profile.", e);
|
Log.e(TAG, "Failed to put vpn profile.", e);
|
||||||
@@ -71,7 +71,7 @@ public class LegacyVpnProfileStore {
|
|||||||
*/
|
*/
|
||||||
public static byte[] get(@NonNull String alias) {
|
public static byte[] get(@NonNull String alias) {
|
||||||
try {
|
try {
|
||||||
return getService().get(alias);
|
return getService().get(alias, ILegacyKeystore.UID_SELF);
|
||||||
} catch (ServiceSpecificException e) {
|
} catch (ServiceSpecificException e) {
|
||||||
if (e.errorCode != PROFILE_NOT_FOUND) {
|
if (e.errorCode != PROFILE_NOT_FOUND) {
|
||||||
Log.e(TAG, "Failed to get vpn profile.", e);
|
Log.e(TAG, "Failed to get vpn profile.", e);
|
||||||
@@ -90,7 +90,7 @@ public class LegacyVpnProfileStore {
|
|||||||
*/
|
*/
|
||||||
public static boolean remove(@NonNull String alias) {
|
public static boolean remove(@NonNull String alias) {
|
||||||
try {
|
try {
|
||||||
getService().remove(alias);
|
getService().remove(alias, ILegacyKeystore.UID_SELF);
|
||||||
return true;
|
return true;
|
||||||
} catch (ServiceSpecificException e) {
|
} catch (ServiceSpecificException e) {
|
||||||
if (e.errorCode != PROFILE_NOT_FOUND) {
|
if (e.errorCode != PROFILE_NOT_FOUND) {
|
||||||
@@ -110,7 +110,7 @@ public class LegacyVpnProfileStore {
|
|||||||
*/
|
*/
|
||||||
public static @NonNull String[] list(@NonNull String prefix) {
|
public static @NonNull String[] list(@NonNull String prefix) {
|
||||||
try {
|
try {
|
||||||
final String[] aliases = getService().list(prefix);
|
final String[] aliases = getService().list(prefix, ILegacyKeystore.UID_SELF);
|
||||||
for (int i = 0; i < aliases.length; ++i) {
|
for (int i = 0; i < aliases.length; ++i) {
|
||||||
aliases[i] = aliases[i].substring(prefix.length());
|
aliases[i] = aliases[i].substring(prefix.length());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user