Loading AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2188,6 +2188,8 @@ <activity android:name=".development.AppPicker" android:label="@string/select_application" /> <activity android:name=".development.AdbQrCodeActivity" /> <activity android:name=".development.DSULoader" android:label="Select DSU Package" android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" /> Loading res/layout-land/adb_qrcode_scanner_fragment.xml 0 → 100644 +97 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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. --> <com.google.android.setupdesign.GlifLayout 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="match_parent" android:icon="@drawable/ic_scan_32dp" app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description"> <LinearLayout style="@style/SudContentFrame" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:id="@+id/camera_layout"> <FrameLayout android:layout_width="@dimen/qrcode_preview_size" android:layout_height="@dimen/qrcode_preview_size" android:clipChildren="true"> <TextureView android:id="@+id/preview_view" android:layout_width="wrap_content" android:layout_height="match_parent"/> <com.android.settings.wifi.qrcode.QrDecorateView android:id="@+id/decorate_view" android:layout_width="wrap_content" android:layout_height="match_parent"/> </FrameLayout> <TextView android:id="@+id/error_message" style="@style/TextAppearance.ErrorText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginStart="?attr/sudMarginStart" android:layout_marginEnd="?attr/sudMarginEnd" android:textAlignment="center" android:visibility="invisible"/> </LinearLayout> <!-- The spinner indicating that the device is waiting for pairing after getting valid QR code --> <LinearLayout android:id="@+id/verifying_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:visibility="gone"> <ProgressBar android:id="@+id/verifying_progress" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/verifying_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/adb_wireless_item_progress_text" android:text="@string/adb_wireless_verifying_qrcode_text" android:accessibilityLiveRegion="polite"/> </LinearLayout> </LinearLayout> </com.google.android.setupdesign.GlifLayout> res/layout/adb_qrcode_scanner_fragment.xml +23 −39 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ <com.google.android.setupdesign.GlifLayout 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="match_parent" android:theme="@style/GlifV3Theme" android:icon="@drawable/ic_scan_32dp"> android:icon="@drawable/ic_scan_32dp" app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description"> <LinearLayout style="@style/SudContentFrame" Loading @@ -32,26 +33,10 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:gravity="center_horizontal" android:id="@+id/camera_layout"> <TextView android:id="@android:id/summary" style="@style/TextAppearance.SudGlifBody" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="?attr/sudMarginStart" android:layout_marginEnd="?attr/sudMarginEnd" android:textAlignment="center" android:accessibilityLiveRegion="polite"/> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" Loading Loading @@ -79,8 +64,6 @@ </LinearLayout> </LinearLayout> <!-- The spinner indicating that the device is waiting for pairing after getting valid QR code Loading Loading @@ -109,4 +92,5 @@ </LinearLayout> </LinearLayout> </com.google.android.setupdesign.GlifLayout> src/com/android/settings/development/AdbQrCodeActivity.java 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.settings.development; import android.app.settings.SettingsEnums; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.FragmentTransaction; import com.android.settings.R; import com.android.settings.wifi.dpp.WifiDppBaseActivity; /** * To scan an ADB QR code to pair a device. * * To use intent action {@code ACTION_ADB_QR_CODE_SCANNER}. */ public class AdbQrCodeActivity extends WifiDppBaseActivity { private static final String TAG = "AdbQrCodeActivity"; static final String TAG_FRAGMENT_ADB_QR_CODE_SCANNER = "adb_qr_code_scanner_fragment"; public static final String ACTION_ADB_QR_CODE_SCANNER = "android.settings.ADB_QR_CODE_SCANNER"; @Override public int getMetricsCategory() { return SettingsEnums.SETTINGS_ADB_WIRELESS; } @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); AdbQrcodeScannerFragment fragment = (AdbQrcodeScannerFragment) mFragmentManager.findFragmentByTag( TAG_FRAGMENT_ADB_QR_CODE_SCANNER); if (fragment == null) { fragment = new AdbQrcodeScannerFragment(); } else { if (fragment.isVisible()) { return; } // When the fragment in back stack but not on top of the stack, we can simply pop // stack because current fragment transactions are arranged in an order mFragmentManager.popBackStackImmediate(); return; } final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment, TAG_FRAGMENT_ADB_QR_CODE_SCANNER); fragmentTransaction.commit(); } @Override protected void handleIntent(Intent intent) { } } src/com/android/settings/development/AdbQrCodePreferenceController.java +4 −8 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.settings.development; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.Intent; import android.debug.IAdbManager; import android.os.RemoteException; import android.os.ServiceManager; Loading @@ -28,7 +28,6 @@ import androidx.fragment.app.Fragment; import androidx.preference.Preference; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SubSettingLauncher; /** * Controller for the "Pair device with QR code" preference in the Wireless debugging Loading Loading @@ -68,12 +67,9 @@ public class AdbQrCodePreferenceController extends BasePreferenceController { return false; } new SubSettingLauncher(preference.getContext()) .setDestination(AdbQrcodeScannerFragment.class.getName()) .setSourceMetricsCategory(SettingsEnums.SETTINGS_ADB_WIRELESS) .setResultListener(mParentFragment, WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST) .launch(); final Intent intent = new Intent(mContext, AdbQrCodeActivity.class); mParentFragment.startActivityForResult(intent, WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST); return true; } } Loading
AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2188,6 +2188,8 @@ <activity android:name=".development.AppPicker" android:label="@string/select_application" /> <activity android:name=".development.AdbQrCodeActivity" /> <activity android:name=".development.DSULoader" android:label="Select DSU Package" android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" /> Loading
res/layout-land/adb_qrcode_scanner_fragment.xml 0 → 100644 +97 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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. --> <com.google.android.setupdesign.GlifLayout 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="match_parent" android:icon="@drawable/ic_scan_32dp" app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description"> <LinearLayout style="@style/SudContentFrame" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:id="@+id/camera_layout"> <FrameLayout android:layout_width="@dimen/qrcode_preview_size" android:layout_height="@dimen/qrcode_preview_size" android:clipChildren="true"> <TextureView android:id="@+id/preview_view" android:layout_width="wrap_content" android:layout_height="match_parent"/> <com.android.settings.wifi.qrcode.QrDecorateView android:id="@+id/decorate_view" android:layout_width="wrap_content" android:layout_height="match_parent"/> </FrameLayout> <TextView android:id="@+id/error_message" style="@style/TextAppearance.ErrorText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginStart="?attr/sudMarginStart" android:layout_marginEnd="?attr/sudMarginEnd" android:textAlignment="center" android:visibility="invisible"/> </LinearLayout> <!-- The spinner indicating that the device is waiting for pairing after getting valid QR code --> <LinearLayout android:id="@+id/verifying_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:visibility="gone"> <ProgressBar android:id="@+id/verifying_progress" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/verifying_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/adb_wireless_item_progress_text" android:text="@string/adb_wireless_verifying_qrcode_text" android:accessibilityLiveRegion="polite"/> </LinearLayout> </LinearLayout> </com.google.android.setupdesign.GlifLayout>
res/layout/adb_qrcode_scanner_fragment.xml +23 −39 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ <com.google.android.setupdesign.GlifLayout 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="match_parent" android:theme="@style/GlifV3Theme" android:icon="@drawable/ic_scan_32dp"> android:icon="@drawable/ic_scan_32dp" app:sudDescriptionText="@string/adb_wireless_qrcode_pairing_description"> <LinearLayout style="@style/SudContentFrame" Loading @@ -32,26 +33,10 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:gravity="center_horizontal" android:id="@+id/camera_layout"> <TextView android:id="@android:id/summary" style="@style/TextAppearance.SudGlifBody" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="?attr/sudMarginStart" android:layout_marginEnd="?attr/sudMarginEnd" android:textAlignment="center" android:accessibilityLiveRegion="polite"/> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" Loading Loading @@ -79,8 +64,6 @@ </LinearLayout> </LinearLayout> <!-- The spinner indicating that the device is waiting for pairing after getting valid QR code Loading Loading @@ -109,4 +92,5 @@ </LinearLayout> </LinearLayout> </com.google.android.setupdesign.GlifLayout>
src/com/android/settings/development/AdbQrCodeActivity.java 0 → 100644 +75 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.settings.development; import android.app.settings.SettingsEnums; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.FragmentTransaction; import com.android.settings.R; import com.android.settings.wifi.dpp.WifiDppBaseActivity; /** * To scan an ADB QR code to pair a device. * * To use intent action {@code ACTION_ADB_QR_CODE_SCANNER}. */ public class AdbQrCodeActivity extends WifiDppBaseActivity { private static final String TAG = "AdbQrCodeActivity"; static final String TAG_FRAGMENT_ADB_QR_CODE_SCANNER = "adb_qr_code_scanner_fragment"; public static final String ACTION_ADB_QR_CODE_SCANNER = "android.settings.ADB_QR_CODE_SCANNER"; @Override public int getMetricsCategory() { return SettingsEnums.SETTINGS_ADB_WIRELESS; } @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); AdbQrcodeScannerFragment fragment = (AdbQrcodeScannerFragment) mFragmentManager.findFragmentByTag( TAG_FRAGMENT_ADB_QR_CODE_SCANNER); if (fragment == null) { fragment = new AdbQrcodeScannerFragment(); } else { if (fragment.isVisible()) { return; } // When the fragment in back stack but not on top of the stack, we can simply pop // stack because current fragment transactions are arranged in an order mFragmentManager.popBackStackImmediate(); return; } final FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.fragment_container, fragment, TAG_FRAGMENT_ADB_QR_CODE_SCANNER); fragmentTransaction.commit(); } @Override protected void handleIntent(Intent intent) { } }
src/com/android/settings/development/AdbQrCodePreferenceController.java +4 −8 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.settings.development; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.Intent; import android.debug.IAdbManager; import android.os.RemoteException; import android.os.ServiceManager; Loading @@ -28,7 +28,6 @@ import androidx.fragment.app.Fragment; import androidx.preference.Preference; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SubSettingLauncher; /** * Controller for the "Pair device with QR code" preference in the Wireless debugging Loading Loading @@ -68,12 +67,9 @@ public class AdbQrCodePreferenceController extends BasePreferenceController { return false; } new SubSettingLauncher(preference.getContext()) .setDestination(AdbQrcodeScannerFragment.class.getName()) .setSourceMetricsCategory(SettingsEnums.SETTINGS_ADB_WIRELESS) .setResultListener(mParentFragment, WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST) .launch(); final Intent intent = new Intent(mContext, AdbQrCodeActivity.class); mParentFragment.startActivityForResult(intent, WirelessDebuggingFragment.PAIRING_DEVICE_REQUEST); return true; } }