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
This commit is contained in:
Evan Chen
2023-01-05 15:13:25 -08:00
parent a43191277e
commit 208f1bbf82
5 changed files with 103 additions and 34 deletions

View File

@@ -0,0 +1,25 @@
<!--
~ 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>

View File

@@ -0,0 +1,25 @@
<!--
~ 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>

View File

@@ -14,43 +14,61 @@
~ 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:id="@+id/data_transfer_confirmation"
style="@style/ContainerLayout">
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
<LinearLayout style="@style/Description">
<TextView
android:id="@+id/title"
style="@style/DescriptionTitle" />
<TextView
android:id="@+id/summary"
style="@style/DescriptionSummary" />
</LinearLayout>
<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:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="16dp">
android:id="@+id/data_transfer_confirmation"
style="@style/ContainerLayout">
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
<Button
android:id="@+id/btn_positive"
style="@style/PositiveButton"
android:text="@string/consent_yes" />
<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" />
<Button
android:id="@+id/btn_negative"
android:layout_marginBottom="12dp"
style="@style/NegativeButton"
android:text="@string/consent_no" />
<LinearLayout style="@style/Description">
<TextView
android:id="@+id/title"
style="@style/DescriptionTitle" />
<TextView
android:id="@+id/summary"
style="@style/DescriptionSummary" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="12dp"
android:layout_marginBottom="18dp">
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
<Button
android:id="@+id/btn_positive"
style="@style/PositiveButton"
android:text="@string/consent_yes" />
<Button
android:id="@+id/btn_negative"
style="@style/NegativeButton"
android:text="@string/consent_no" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -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>

View File

@@ -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";