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

Commit 6fd0716f authored by Jan Tomljanovic's avatar Jan Tomljanovic
Browse files

Add SafetyCenter entry to Settings.

Test: atest SettingsUnitTests
Bug: 204978295
Change-Id: I9bedb58ad740b4ee76620e04675a0aefa659566a
parent d2d6e6ac
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2021 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<!-- TODO(b/208624929): Update to an UX approved icon. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportHeight="24"
    android:viewportWidth="24"
    android:tint="?android:attr/colorControlNormal">
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M12,15m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M18.5,1C16.01,1 14,3.01 14,5.5V8H6c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V10c0,-1.1 -0.9,-2 -2,-2h-2V5.5C16,4.12 17.12,3 18.5,3C19.88,3 21,4.12 21,5.5V6h2V5.5C23,3.01 20.99,1 18.5,1zM18,10v10H6V10H18z"/>
</vector>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
    <string name="menu_key_display" translatable="false">top_level_display</string>
    <string name="menu_key_wallpaper" translatable="false">top_level_wallpaper</string>
    <string name="menu_key_accessibility" translatable="false">top_level_accessibility</string>
    <string name="menu_key_safety_center" translatable="false">top_level_safety_center</string>
    <string name="menu_key_security" translatable="false">top_level_security</string>
    <string name="menu_key_privacy" translatable="false">top_level_privacy</string>
    <string name="menu_key_location" translatable="false">top_level_location</string>
+6 −0
Original line number Diff line number Diff line
@@ -722,6 +722,12 @@
    <string name="security_status_title">Security status</string>
    <!-- Summary for Security settings, explaining a few important settings under it [CHAR LIMIT=NONE] -->
    <string name="security_dashboard_summary">Screen lock, Find My Device, app security</string>
    <!-- TODO(b/208624929): Update to an UX approved title and char limit. -->
    <!-- Main Settings screen setting title for the item that takes you to the safety center [CHAR LIMIT=60] -->
    <string name="safety_center_title">Security &amp; privacy</string>
    <!-- TODO(b/208624929): Update to an UX approved summary and char limit. -->
    <!-- Main Settings screen setting summary for the item that takes you to the safety center [CHAR LIMIT=60] -->
    <string name="safety_center_summary">Permissions, screen lock, app security</string>
    <!-- Face enrollment and settings --><skip />
    <!-- Note: Update FaceEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
+9 −0
Original line number Diff line number Diff line
@@ -116,6 +116,15 @@
        settings:highlightableMenuKey="@string/menu_key_accessibility"
        settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/>

    <com.android.settings.widget.HomepagePreference
        android:icon="@drawable/ic_settings_safety_center"
        android:key="top_level_safety_center"
        android:order="-55"
        android:title="@string/safety_center_title"
        android:summary="@string/safety_center_summary"
        settings:highlightableMenuKey="@string/menu_key_safety_center"
        settings:controller="com.android.settings.safetycenter.TopLevelSafetyCenterEntryPreferenceController"/>

    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.security.SecuritySettings"
        android:icon="@drawable/ic_settings_security_white"
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.safetycenter;

import android.provider.DeviceConfig;

import com.android.internal.annotations.VisibleForTesting;

/** Knows whether safety center is enabled or disabled. */
public class SafetyCenterStatus {

    /** Whether SafetyCenter page is enabled. */
    @VisibleForTesting
    static final String SAFETY_CENTER_IS_ENABLED = "safety_center_is_enabled";

    /** Returns true is SafetyCenter page is enabled, false otherwise. */
    public static boolean isEnabled() {
        // TODO(b/208625216): use SafetyManager API instead
        return DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_PRIVACY, SAFETY_CENTER_IS_ENABLED, false);
    }
}
Loading