Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0702b12 authored by Wang Han's avatar Wang Han Committed by dwardo
Browse files

lineage-sdk: Drop root status of Trust

Change-Id: Iaec0b2a8a781a0e9d301a21a3af5e4362a5d6630
parent 7f4f356c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1002,12 +1002,10 @@ package lineageos.trust {
    field public static final int TRUST_FEATURE_LEVEL_GOOD = 0; // 0x0
    field public static final int TRUST_FEATURE_LEVEL_POOR = 1; // 0x1
    field public static final int TRUST_FEATURE_PLATFORM_SECURITY_PATCH = 2; // 0x2
    field public static final int TRUST_FEATURE_ROOT = 1; // 0x1
    field public static final int TRUST_FEATURE_SELINUX = 0; // 0x0
    field public static final int TRUST_FEATURE_VENDOR_SECURITY_PATCH = 3; // 0x3
    field public static final java.lang.String TRUST_INTERFACE_PERMISSION = "lineageos.permission.TRUST_INTERFACE";
    field public static final int TRUST_WARN_PUBLIC_KEY = 4; // 0x4
    field public static final int TRUST_WARN_ROOT = 2; // 0x2
    field public static final int TRUST_WARN_SELINUX = 1; // 0x1
  }

+0 −21
Original line number Diff line number Diff line
@@ -179,8 +179,6 @@ public class TrustInterfaceService extends LineageSystemService {
        switch (feature) {
            case TrustInterface.TRUST_FEATURE_SELINUX:
                return getSELinuxStatus();
            case TrustInterface.TRUST_FEATURE_ROOT:
                return getRootStatus();
            case TrustInterface.TRUST_FEATURE_PLATFORM_SECURITY_PATCH:
                return getSecurityPatchStatus(PLATFORM_SECURITY_PATCHES);
            case TrustInterface.TRUST_FEATURE_VENDOR_SECURITY_PATCH:
@@ -228,10 +226,6 @@ public class TrustInterfaceService extends LineageSystemService {
                title = R.string.trust_notification_title_security;
                message = R.string.trust_notification_content_selinux;
                break;
            case TrustInterface.TRUST_WARN_ROOT:
                title = R.string.trust_notification_title_root;
                message = R.string.trust_notification_content_root;
                break;
            case TrustInterface.TRUST_WARN_PUBLIC_KEY:
                title = R.string.trust_notification_title_security;
                message = R.string.trust_notification_content_keys;
@@ -261,21 +255,6 @@ public class TrustInterfaceService extends LineageSystemService {
                TrustInterface.TRUST_FEATURE_LEVEL_BAD;
    }

    private int getRootStatus() {
        String status = SystemProperties.get("persist.sys.root_access", "0");
        switch (status) {
            case "0":
                return TrustInterface.TRUST_FEATURE_LEVEL_GOOD;
            case "1":
            case "3":
                return TrustInterface.TRUST_FEATURE_LEVEL_BAD;
            case "2":
                return TrustInterface.TRUST_FEATURE_LEVEL_POOR;
            default:
                return TrustInterface.ERROR_UNDEFINED;
        }
    }

    private int getSecurityPatchStatus(String target) {
        String patchLevel = SystemProperties.get(target);
        if (TextUtils.isEmpty(patchLevel)) {
+0 −2
Original line number Diff line number Diff line
@@ -167,8 +167,6 @@
    <string name="trust_notification_channel">Trust alerts</string>
    <string name="trust_notification_title_security">Trust \u2022 System security</string>
    <string name="trust_notification_content_selinux">SELinux is not enforcing, your security has been weakened</string>
    <string name="trust_notification_title_root">Trust \u2022 Root access</string>
    <string name="trust_notification_content_root">An app is using the root privileges right now</string>
    <string name="trust_notification_content_keys">This build was signed with public keys</string>
    <string name="trust_notification_title_onboarding">Discover Trust</string>
    <string name="trust_notification_content_onboarding">Get to know how to assure your device is safe</string>
+0 −2
Original line number Diff line number Diff line
@@ -159,8 +159,6 @@
    <java-symbol type="string" name="trust_notification_channel" />
    <java-symbol type="string" name="trust_notification_title_security" />
    <java-symbol type="string" name="trust_notification_content_selinux" />
    <java-symbol type="string" name="trust_notification_title_root" />
    <java-symbol type="string" name="trust_notification_content_root" />
    <java-symbol type="string" name="trust_notification_content_keys" />
    <java-symbol type="string" name="trust_notification_title_onboarding" />
    <java-symbol type="string" name="trust_notification_content_onboarding" />
+0 −23
Original line number Diff line number Diff line
@@ -74,18 +74,6 @@ public class TrustInterface {
     */
    public static final int TRUST_FEATURE_SELINUX = 0;

    /**
     * Trust feature indicator: Root access
     *
     * Possible status:
     *    * {@link #TRUST_FEATURE_LEVEL_GOOD}: disabled
     *    * {@link #TRUST_FEATURE_LEVEL_POOR}: ADB only
     *    * {@link #TRUST_FEATURE_LEVEL_BAD}: apps and ADB
     *
     * @see #getLevelForFeature
     */
    public static final int TRUST_FEATURE_ROOT = 1;

    /**
     * Trust feature indicator: Platform Security patches
     *
@@ -150,16 +138,6 @@ public class TrustInterface {
     */
    public static final int TRUST_WARN_SELINUX = 1;

    /**
     * Trust warning: Root access
     *
     * When {@link #TRUST_FEATURE_ROOT} is not {@link #TRUST_FEATURE_LEVEL_GOOD}
     * notify the user about the issue
     *
     * @see #postNotificationForFeature
     */
    public static final int TRUST_WARN_ROOT = 1 << 1;

    /**
     * Trust warning: Public Key build signature
     *
@@ -180,7 +158,6 @@ public class TrustInterface {
     */
    public static final int TRUST_WARN_MAX_VALUE =
            TRUST_WARN_SELINUX |
            TRUST_WARN_ROOT |
            TRUST_WARN_PUBLIC_KEY;

    private static final String TAG = "TrustInterface";