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

Commit 580b7af1 authored by Alex Johnston's avatar Alex Johnston
Browse files

Add request manage credentials to Settings

Background
* This is part of the work to support
  a credential management app on
  unmanaged devices.

Changes
* Add new activity to Settings to display
  a screen to the user requesting whether
  the calling app can manage their
  KeyChain credentials.
* Display the authentication policy

Manual Testing
* Verify screen is not displayed if intent
  action is not android.security.MANAGE_CREDENTIALS
* Verify screen is not displayed if authentication
  policy is not valid
* Verify button panel is visible if all items in the
  authentication policy are displayed
* Verify button panel is not visible if not all items
  in the authentication policy are displayed. Verify
  that scrolling to the bottom of the item list, the
  button panel becomes visible.

Bug: 165641221
Test: Manual testing
      make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.security.RequestManageCredentialsTest
Change-Id: Ie23b226f1a285b3de6ec3e91b8880d9144bb24a3
parent ab20590d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1431,6 +1431,15 @@
                  android:exported="false">
        </activity>

        <activity android:name=".security.RequestManageCredentials"
                  android:theme="@style/Theme.RequestManageCredentials"
                  android:exported="true">
            <intent-filter>
                <action android:name="android.security.MANAGE_CREDENTIALS"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

        <activity
            android:name="Settings$DeviceAdminSettingsActivity"
            android:exported="true"
+50 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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.
  -->
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/AppAuthenticationPolicyItem"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/app_icon"
        style="@style/AppAuthenticationPolicyIcon"
        android:layout_width="24dp"
        android:layout_height="24dp"/>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/app_icon"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/app_name"
            style="@style/AppAuthenticationPolicyText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/uris"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

    </LinearLayout>

</RelativeLayout>
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/uri_name"
        style="@style/AppUriAuthenticationPolicyText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>
+62 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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.
  -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/apps_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

        <LinearLayout
            android:id="@+id/button_panel"
            style="@style/RequestManageCredentialsButtonPanel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/dont_allow_button"
                style="@style/RequestManageCredentialsDontAllowButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/request_manage_credentials_dont_allow"/>

            <Space
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:visibility="invisible"/>

            <Button
                android:id="@+id/allow_button"
                style="@style/RequestManageCredentialsAllowButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/request_manage_credentials_allow"/>

        </LinearLayout>

    </RelativeLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
+42 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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"
    style="@style/RequestManageCredentialsHeader"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/credential_management_app_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:contentDescription="@null"/>

    <TextView
        android:id="@+id/credential_management_app_title"
        style="@style/RequestManageCredentialsTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <TextView
        android:id="@+id/credential_management_app_description"
        style="@style/RequestManageCredentialsDescription"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/request_manage_credentials_description"/>

</LinearLayout>
Loading