diff options
author | Joey <joey@lineageos.org> | 2019-01-09 22:27:01 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2019-02-04 20:48:15 +0100 |
commit | 0cf297348dff35e7f41dadb69fa8e35b833dff6c (patch) | |
tree | bbd3710d984c4c5f663547443f5108acb49619a8 /sdk | |
parent | d853f892aa85741040b1a868e3761343e62d4587 (diff) | |
download | lineage-sdk-0cf297348dff35e7f41dadb69fa8e35b833dff6c.tar.gz lineage-sdk-0cf297348dff35e7f41dadb69fa8e35b833dff6c.tar.bz2 lineage-sdk-0cf297348dff35e7f41dadb69fa8e35b833dff6c.zip |
sdk: add Trust usb restrictor
Change-Id: I8ba443606e83fcfc6f23e62f434f10f25eb69e1b
Signed-off-by: Joey <joey@lineageos.org>
Diffstat (limited to 'sdk')
-rw-r--r-- | sdk/src/java/lineageos/providers/LineageSettings.java | 15 | ||||
-rw-r--r-- | sdk/src/java/lineageos/trust/ITrustInterface.aidl | 3 | ||||
-rw-r--r-- | sdk/src/java/lineageos/trust/TrustInterface.java | 16 |
3 files changed, 30 insertions, 4 deletions
diff --git a/sdk/src/java/lineageos/providers/LineageSettings.java b/sdk/src/java/lineageos/providers/LineageSettings.java index 7feabb1c..812072a5 100644 --- a/sdk/src/java/lineageos/providers/LineageSettings.java +++ b/sdk/src/java/lineageos/providers/LineageSettings.java @@ -1,6 +1,6 @@ /** * Copyright (C) 2015-2016 The CyanogenMod Project - * Copyright (C) 2017-2018 The LineageOS Project + * Copyright (C) 2017-2019 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -3088,6 +3088,18 @@ public final class LineageSettings { sBooleanValidator; /** + * Restrict USB when the screen is locked + * 0 = Off, 1 = On + * + * @hide + */ + public static final String TRUST_RESTRICT_USB_KEYGUARD = "trust_restrict_usb"; + + /** @hide */ + public static final Validator TRUST_RESTRICT_USB_KEYGUARD_VALIDATOR = + sBooleanValidator; + + /** * Trust warnings status * * Stores flags for each feature @@ -3210,6 +3222,7 @@ public final class LineageSettings { VALIDATORS.put(NETWORK_TRAFFIC_UNITS, NETWORK_TRAFFIC_UNITS_VALIDATOR); VALIDATORS.put(NETWORK_TRAFFIC_SHOW_UNITS, NETWORK_TRAFFIC_SHOW_UNITS_VALIDATOR); VALIDATORS.put(TRUST_NOTIFICATIONS, TRUST_NOTIFICATIONS_VALIDATOR); + VALIDATORS.put(TRUST_RESTRICT_USB_KEYGUARD, TRUST_RESTRICT_USB_KEYGUARD_VALIDATOR); VALIDATORS.put(TRUST_WARNINGS, TRUST_WARNINGS_VALIDATOR); } diff --git a/sdk/src/java/lineageos/trust/ITrustInterface.aidl b/sdk/src/java/lineageos/trust/ITrustInterface.aidl index 061bd16f..77fffbf6 100644 --- a/sdk/src/java/lineageos/trust/ITrustInterface.aidl +++ b/sdk/src/java/lineageos/trust/ITrustInterface.aidl @@ -1,6 +1,6 @@ /* ** -** Copyright (C) 2018 The LineageOS Project +** Copyright (C) 2018-2019 The LineageOS Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ interface ITrustInterface { boolean postNotificationForFeature(int feature); boolean removeNotificationForFeature(int feature); + boolean hasUsbRestrictor(); int getLevelForFeature(int feature); void runTest(); } diff --git a/sdk/src/java/lineageos/trust/TrustInterface.java b/sdk/src/java/lineageos/trust/TrustInterface.java index 2df0b755..7f2d233e 100644 --- a/sdk/src/java/lineageos/trust/TrustInterface.java +++ b/sdk/src/java/lineageos/trust/TrustInterface.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018, The LineageOS Project + * Copyright (C) 2018-2019 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,6 +232,7 @@ public class TrustInterface { return sService; } + /** @hide **/ public boolean postNotificationForFeature(int feature) { if (sService == null) { return false; @@ -256,6 +257,18 @@ public class TrustInterface { return false; } + public boolean hasUsbRestrictor() { + if (sService == null) { + return false; + } + try { + return sService.hasUsbRestrictor(); + } catch (RemoteException e) { + Log.e(TAG, e.getLocalizedMessage(), e); + } + return false; + } + public int getLevelForFeature(int feature) { if (sService == null) { return ERROR_UNDEFINED; @@ -281,4 +294,3 @@ public class TrustInterface { return; } } - |