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

Commit 5ff7c28a authored by Joey's avatar Joey Committed by Bruno Martins
Browse files

parts: add Trust usb restrictor



Change-Id: I97aa86dda098d756a6365806b4d5be5d5f40c835
Signed-off-by: default avatarJoey <joey@lineageos.org>
parent 58673c8d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright (C) 2015 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.
@@ -733,6 +733,8 @@
    <string name="trust_onboarding_description">Trust helps you keep your device secure and protect your privacy.\nThe Trust icon will only show when the contents of the page have been verified.</string>
    <string name="trust_onboarding_learn_more">Learn more</string>
    <string name="trust_onboarding_done">Got it</string>
    <string name="trust_restrict_usb_title">Restrict USB</string>
    <string name="trust_restrict_usb_summary">Disable new USB gadgets when the device is locked</string>

    <!-- Sms limit -->
    <string name="sms_security_check_limit_title">SMS message limit</string>
+7 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     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.
@@ -46,6 +46,12 @@
        <org.lineageos.internal.lineageparts.LineagePartsPreference
            android:key="privacy_guard_manager" />

        <lineageos.preference.LineageSecureSettingSwitchPreference
            android:key="trust_restrict_usb"
            android:title="@string/trust_restrict_usb_title"
            android:summary="@string/trust_restrict_usb_summary"
            android:defaultValue="false" />

        <org.lineageos.internal.lineageparts.LineagePartsPreference
            android:key="lineagestats" />

+9 −1
Original line number Diff line number Diff line
/*
 * 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.
@@ -29,6 +29,7 @@ import android.util.Log;
import org.lineageos.lineageparts.R;
import org.lineageos.lineageparts.SettingsPreferenceFragment;

import lineageos.preference.LineageSecureSettingSwitchPreference;
import lineageos.providers.LineageSettings;
import lineageos.trust.TrustInterface;

@@ -40,6 +41,7 @@ public class TrustPreferences extends SettingsPreferenceFragment {
    private Preference mSecurityPatchesPref;
    private Preference mEncryptionPref;
    private PreferenceCategory mToolsCategory;
    private LineageSecureSettingSwitchPreference mUsbRestrictorPref;
    private ListPreference mSmsLimitPref;

    private PreferenceCategory mWarnScreen;
@@ -63,6 +65,8 @@ public class TrustPreferences extends SettingsPreferenceFragment {
        mSecurityPatchesPref = findPreference("trust_security_patch");
        mEncryptionPref = findPreference("trust_encryption");
        mToolsCategory = (PreferenceCategory) findPreference("trust_category_tools");
        mUsbRestrictorPref = (LineageSecureSettingSwitchPreference)
                mToolsCategory.findPreference("trust_restrict_usb");
        mSmsLimitPref = (ListPreference) mToolsCategory.findPreference("sms_security_check_limit");

        mWarnScreen = (PreferenceCategory) findPreference("trust_category_warnings");
@@ -109,6 +113,10 @@ public class TrustPreferences extends SettingsPreferenceFragment {
        if (!isTelephony()) {
            mToolsCategory.removePreference(mSmsLimitPref);
        }

        if (!mInterface.hasUsbRestrictor()) {
            mToolsCategory.removePreference(mUsbRestrictorPref);
        }
    }

    private void setupSELinux(int level) {