Companion Device App showing in Settings

Added a feature that users are able to see/remove the apps' associations
in Settings/Connected devices.
It will display the icon of the associations app, app's name and a button
that users are able to remove the associations. Also it will pop up a
dialog alerting user before remove the associations.

Screenshot:
https://screenshot.googleplex.com/APSRhW2retYmAAK

Bug: 165951651
Test: Manually Test

Change-Id: Iccaeaf516e8a78d4ef33415c1c2d7379139ec88c
This commit is contained in:
Eugene Susla
2020-11-10 11:54:39 -08:00
committed by Evan Chen
parent 83b061d3da
commit 7dc2624b51
10 changed files with 629 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:contentDescription="@string/remove_association_button"
android:id="@+id/remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_clear"
android:background="@android:color/transparent"/>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingTop="16dp"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
</LinearLayout>

View File

@@ -205,6 +205,9 @@
<dimen name="bluetooth_pairing_edittext_padding">21dp</dimen>
<dimen name="bluetooth_checkbox_padding">16dp</dimen>
<!-- CompanionAppWidgetPreferencce Padding -->
<dimen name="bluetooth_companion_app_widget">20dp</dimen>
<!-- WiFi Preferences -->
<dimen name="wifi_divider_height">1px</dimen>
<dimen name="wifi_ap_band_checkbox_padding">16dp</dimen>

View File

@@ -1817,6 +1817,10 @@
<string name="bluetooth_device_mac_address">Device\'s Bluetooth address: <xliff:g id="address">%1$s</xliff:g></string>
<!-- Bluetooth device details. The title of a confirmation dialog for unpairing a paired device. [CHAR LIMIT=60] -->
<string name="bluetooth_unpair_dialog_title">Forget device?</string>
<!-- Content Description for companion device app associations removal button [CHAR LIMIT=28]-->
<string name="remove_association_button">Remove association</string>
<!-- Bluetooth device details companion apps. The title of a confirmation dialog for remove an app. [CHAR LIMIT=60] -->
<string name="bluetooth_companion_app_remove_association_dialog_title">Disconnect App?</string>
<!-- Bluetooth device details. The body of a confirmation dialog for unpairing a paired device. -->
<string name="bluetooth_unpair_dialog_body" product="default">Your phone will no longer be paired with <xliff:g id="device_name">%1$s</xliff:g></string>
@@ -1824,12 +1828,16 @@
<string name="bluetooth_unpair_dialog_body" product="tablet">Your tablet will no longer be paired with <xliff:g id="device_name">%1$s</xliff:g></string>
<!-- Bluetooth device details. The body of a confirmation dialog for unpairing a paired device. -->
<string name="bluetooth_unpair_dialog_body" product="device">Your device will no longer be paired with <xliff:g id="device_name">%1$s</xliff:g></string>
<!-- Bluetooth device details companion apps. The body of confirmation dialog for remove association. [CHAR LIMIT=60] -->
<string name="bluetooth_companion_app_body"><xliff:g id="app_name" example="App Name">%1$s</xliff:g> app will no longer connect to your <xliff:g id="device_name" example="Device Name">%2$s</xliff:g></string>
<!-- Bluetooth device details. The body of a confirmation dialog for unpairing a paired device. [CHAR LIMIT=NONE] -->
<string name="bluetooth_untethered_unpair_dialog_body"><xliff:g id="device_name" example="Jack's headphone">%1$s</xliff:g> will no longer be paired with any device linked to this account</string>
<!-- Bluetooth device details. In the confirmation dialog for unpairing a paired device, this is the label on the button that will complete the unpairing action. -->
<string name="bluetooth_unpair_dialog_forget_confirm_button">Forget device</string>
<!-- Bluetooth device details companion apps. In the confirmation dialog for removing an associated app, this is the label on the button that will complete the disassociate action. [CHAR LIMIT=80] -->
<string name = "bluetooth_companion_app_remove_association_confirm_button">Disconnect app</string>
<!-- Bluetooth settings. The title of the screen to pick which profiles to connect to on the device. For example, headphones may have both A2DP and headset, this allows the users to choose which one they want to connect to. -->
<string name="bluetooth_connect_specific_profiles_title">Connect to\u2026</string>

View File

@@ -44,6 +44,9 @@
settings:allowDividerBelow="true"
settings:allowDividerAbove="true"/>
<PreferenceCategory
android:key="device_companion_apps"/>
<PreferenceCategory
android:key="bluetooth_profiles"/>