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

Commit 208f1bbf authored by Evan Chen's avatar Evan Chen
Browse files

Polish CDM permission sync UI

1. Add a warning header.
2. Add empty lines for the description.
3. Add a scrollView in the layout

Bug: 263327455
Test: CTS
Change-Id: Ie1243b28ca793a4db4a6f5facd24dda2ae99df6c
parent a4319127
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2023 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.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="@android:color/system_accent1_200">
    <path android:fillColor="@android:color/white"
          android:pathData="M1,21 L12,2 23,21ZM4.45,19H19.55L12,6ZM12,18Q12.425,18 12.713,17.712Q13,17.425 13,17Q13,16.575 12.713,16.288Q12.425,16 12,16Q11.575,16 11.288,16.288Q11,16.575 11,17Q11,17.425 11.288,17.712Q11.575,18 12,18ZM11,15H13V10H11ZM12,12.5Z"/>
</vector>
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2023 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.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="@android:color/system_accent1_600">
    <path android:fillColor="@android:color/white"
          android:pathData="M1,21 L12,2 23,21ZM4.45,19H19.55L12,6ZM12,18Q12.425,18 12.713,17.712Q13,17.425 13,17Q13,16.575 12.713,16.288Q12.425,16 12,16Q11.575,16 11.288,16.288Q11,16.575 11,17Q11,17.425 11.288,17.712Q11.575,18 12,18ZM11,15H13V10H11ZM12,12.5Z"/>
</vector>
 No newline at end of file
+47 −29
Original line number Diff line number Diff line
@@ -14,13 +14,29 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    style="@style/ScrollViewStyle">

    <LinearLayout
        android:id="@+id/data_transfer_confirmation"
        style="@style/ContainerLayout">

        <!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->

        <ImageView
            android:id="@+id/header_icon"
            android:layout_width="match_parent"
            android:layout_height="32dp"
            android:gravity="center"
            android:layout_marginTop="18dp"
            android:src="@drawable/ic_warning"
            android:contentDescription="@null" />

        <LinearLayout style="@style/Description">

            <TextView
                android:id="@+id/title"
                style="@style/DescriptionTitle" />
@@ -36,7 +52,8 @@
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical"
        android:layout_marginTop="16dp">
            android:layout_marginTop="12dp"
            android:layout_marginBottom="18dp">

            <!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->

@@ -47,10 +64,11 @@

            <Button
                android:id="@+id/btn_negative"
            android:layout_marginBottom="12dp"
                style="@style/NegativeButton"
                android:text="@string/consent_no" />

        </LinearLayout>

    </LinearLayout>

</ScrollView>
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -117,8 +117,7 @@
    <string name="permission_sync_confirmation_title">Give apps on &lt;strong&gt;<xliff:g id="companion_device_name" example="Galaxy Watch 5">%1$s</xliff:g>&lt;/strong&gt; the same permissions as on &lt;strong&gt;<xliff:g id="primary_device_name" example="Pixel 6">%2$s</xliff:g>&lt;/strong&gt;?</string>

    <!-- Text of the permission sync explanation in the confirmation dialog. [CHAR LIMIT=NONE] -->
    <string name="permission_sync_summary">&lt;p&gt;This may include Microphone, Camera, and Location access, and other sensitive permissions on &lt;strong&gt;<xliff:g id="companion_device_name" example="Galaxy Watch 5">%1$s</xliff:g>&lt;/strong&gt;.&lt;/p&gt;
        &lt;p&gt;You can change these permissions any time in your Settings on &lt;strong&gt;<xliff:g id="companion_device_name" example="Galaxy Watch 5">%1$s</xliff:g>&lt;/strong&gt;.&lt;/p&gt;</string>
    <string name="permission_sync_summary">This may include &lt;strong&gt;Microphone&lt;/strong&gt;, &lt;strong&gt;Camera&lt;/strong&gt;, and &lt;strong&gt;Location access&lt;/strong&gt;, and other sensitive permissions on &lt;strong&gt;<xliff:g id="companion_device_name" example="My Watch">%1$s</xliff:g>&lt;/strong&gt;. &lt;br/&gt;&lt;br/&gt;You can change these permissions any time in your Settings on &lt;strong&gt;<xliff:g id="companion_device_name" example="My Watch">%1$s</xliff:g>&lt;/strong&gt;.</string>

    <!--Description for vendor icon [CHAR LIMIT=30]-->
    <string name="vendor_icon_description">App Icon</string>
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.companiondevicemanager.Utils.getHtmlFromResources;

import static java.util.Objects.requireNonNull;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.companion.datatransfer.PermissionSyncRequest;
import android.companion.datatransfer.SystemDataTransferRequest;
@@ -37,6 +38,7 @@ import android.widget.TextView;
/**
 * This activity manages the UI of companion device data transfer.
 */
@SuppressLint("LongLogTag")
public class CompanionDeviceDataTransferActivity extends Activity {

    private static final String LOG_TAG = "CDM_CompanionDeviceDataTransferActivity";