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

Commit 79b9bfe5 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Notification listeners can be enabled in Settings>Security.

Also known as android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS.

Bug: 8454150
Change-Id: I0c2433bf58ba4c78cd461326bd014535c7f67578
parent e44f5e2b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1572,6 +1572,21 @@
                android:resource="@id/user_settings" />
        </activity>

        <activity android:name="Settings$NotificationAccessSettingsActivity"
                  android:label="@string/manage_notification_access"
                  android:taskAffinity=""
                  android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.NotificationAccessSettings" />
            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
                       android:resource="@id/security_settings" />
        </activity>

        <receiver android:name=".widget.SettingsAppWidgetProvider"
                android:label="@string/gadget_title"
                android:exported="true"
+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1">
        <ListView android:id="@android:id/list"
                android:layout_width="match_parent" 
                android:layout_height="match_parent"
                android:drawSelectorOnTop="false"
                android:fastScrollEnabled="true" />
        <TextView android:id="@android:id/empty"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="@string/no_notification_listeners"
                android:textAppearance="?android:attr/textAppearanceMedium" />
    </FrameLayout>
</LinearLayout>
+77 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, 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.
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:orientation="horizontal"
    android:paddingEnd="6dip"
    android:gravity="center_vertical"
    >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="@android:dimen/app_icon_size"
        android:layout_height="@android:dimen/app_icon_size"
        android:layout_gravity="center_vertical"
        android:scaleType="centerInside"
        android:contentDescription="@null"
        />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dip"
        android:layout_marginBottom="8dip"
        android:orientation="vertical"
        android:gravity="left|center_vertical"
        android:layout_weight="1">

        <TextView android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal" />

        <TextView android:id="@+id/description"
            android:visibility="gone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dip"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:attr/textColorSecondary"
            android:maxLines="4" />

    </LinearLayout>

    <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginEnd="16dip"
        android:layout_marginStart="16dip"
        android:focusable="false"
        android:clickable="false" />

</LinearLayout>
+31 −0
Original line number Diff line number Diff line
@@ -983,6 +983,37 @@
    <!-- Summary of preference to manage device policies -->
    <string name="manage_device_admin_summary">View or deactivate device administrators</string>

    <!-- Notification access settings (part of Security) -->

    <!-- Title of preference to manage notification listeners -->
    <string name="manage_notification_access">Notification access</string>

    <!-- Summary of preference to manage notification listeners, when none are enabled -->
    <string name="manage_notification_access_summary_zero">Apps cannot read notifications</string>

    <!-- Summary of preference to manage notification listeners, when one or more are enabled
         and are therefore able to read the user's notifications -->
    <plurals name="manage_notification_access_summary_nonzero">
        <item quantity="one">%d app can read notifications</item>
        <item quantity="other">%d apps can read notifications</item>
    </plurals>

    <!-- String to show in the list of notification listeners, when none is installed -->
    <string name="no_notification_listeners">No notification listeners are installed.</string>

    <!-- Title for a warning message about security implications of enabling a notification
          listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
    <string name="notification_listener_security_warning_title">Enable
         <xliff:g id="service" example="NotificationReader">%1$s</xliff:g>?</string>
    <!-- Summary for a warning message about security implications of enabling a notification
          listener, displayed as a dialog message. [CHAR LIMIT=NONE] -->
    <string name="notification_listener_security_warning_summary">
        <xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to 
        read all notifications posted by the system or any installed app, which may include personal
        information such as contact names and the text of messages sent to you. It will also be able
        to dismiss these notifications or touch action buttons within them.
    </string>

    <!-- Bluetooth settings -->
    <!-- Bluetooth settings check box title on Main Settings screen -->
    <string name="bluetooth_quick_toggle_title">Bluetooth</string>
+7 −0
Original line number Diff line number Diff line
@@ -58,6 +58,13 @@
                android:summaryOff="@string/verify_applications_summary"
                android:summaryOn="@string/verify_applications_summary"
                android:persistent="false" />

        <Preference
                android:key="manage_notification_access"
                android:title="@string/manage_notification_access"
                android:persistent="false"
                android:fragment="com.android.settings.NotificationAccessSettings"/>

    </PreferenceCategory>

    <PreferenceCategory android:key="credentials_management"
Loading