Snap for 7489879 from f151a04d43 to sc-v2-release
Change-Id: Ief94460b2ff680d551ff7d662d6a4dca5f1024d4
This commit is contained in:
@@ -17,8 +17,7 @@
|
||||
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
|
||||
@@ -2226,7 +2225,7 @@
|
||||
|
||||
<activity android:name=".bluetooth.RequestPermissionActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:permission="android.permission.BLUETOOTH"
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.BluetoothPermission">
|
||||
<intent-filter android:priority="1">
|
||||
@@ -2269,7 +2268,7 @@
|
||||
<activity android:name=".bluetooth.RequestPermissionHelperActivity"
|
||||
android:label="@string/bluetooth_pairing_request"
|
||||
android:excludeFromRecents="true"
|
||||
android:permission="android.permission.BLUETOOTH"
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT"
|
||||
android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight">
|
||||
</activity>
|
||||
|
||||
@@ -2284,7 +2283,7 @@
|
||||
|
||||
<receiver android:name=".bluetooth.BluetoothPermissionRequest"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BLUETOOTH_ADMIN">
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT">
|
||||
<intent-filter>
|
||||
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST" />
|
||||
<action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL" />
|
||||
@@ -2294,7 +2293,7 @@
|
||||
<activity android:name=".bluetooth.BluetoothPermissionActivity"
|
||||
android:label="@string/bluetooth_connection_permission_request"
|
||||
android:excludeFromRecents="true"
|
||||
android:permission="android.permission.BLUETOOTH_ADMIN"
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
|
||||
<intent-filter android:priority="1">
|
||||
@@ -3549,7 +3548,7 @@
|
||||
<activity android:name="Settings$BluetoothDeviceDetailActivity"
|
||||
android:label="@string/device_details_title"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BLUETOOTH_ADMIN">
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@@ -3754,7 +3753,7 @@
|
||||
<receiver
|
||||
android:name=".media.BluetoothPairingReceiver"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BLUETOOTH_ADMIN">
|
||||
android:permission="android.permission.BLUETOOTH_CONNECT">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.LAUNCH_BLUETOOTH_PAIRING"/>
|
||||
</intent-filter>/>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 603 B |
31
res/drawable/ic_alert_red.xml
Normal file
31
res/drawable/ic_alert_red.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?android:attr/colorError"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M21.26,18L13.73,4.99c-0.77,-1.33 -2.69,-1.33 -3.46,0L2.74,18c-0.77,1.33 0.19,3 1.73,3h15.06C21.07,21 22.03,19.33 21.26,18zM4.47,19L12,5.99L19.53,19H4.47z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M11,11v2c0,0.55 0.45,1 1,1c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1C11.45,10 11,10.45 11,11z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,17m-1,0a1,1 0,1 1,2 0a1,1 0,1 1,-2 0" />
|
||||
</vector>
|
||||
@@ -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.
|
||||
-->
|
||||
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/settings_panel_corner_radius"
|
||||
android:topRightRadius="@dimen/settings_panel_corner_radius"
|
||||
android:bottomLeftRadius="0dp"
|
||||
android:bottomRightRadius="0dp"/>
|
||||
<solid android:color="?android:attr/colorBackground" />
|
||||
</shape>
|
||||
</inset>
|
||||
24
res/drawable/tabs_indicator_background.xml
Normal file
24
res/drawable/tabs_indicator_background.xml
Normal 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.
|
||||
-->
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="?android:attr/textColorSecondaryInverse"/>
|
||||
<corners android:radius="8dp"/>
|
||||
<size android:height="4dp"/>
|
||||
</shape>
|
||||
@@ -18,37 +18,24 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:icon="@drawable/ic_alert_red">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sud_layout_icon"
|
||||
style="@style/SudGlifIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/ic_warning_googred_48dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sud_layout_title"
|
||||
style="@style/SudGlifHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/ca_certificate_warning_title"/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sud_layout_description"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textSize="18sp"
|
||||
android:alpha="0.7"
|
||||
android:text="@string/ca_certificate_warning_description"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -30,15 +30,18 @@
|
||||
|
||||
<!-- Title -->
|
||||
<com.google.android.setupdesign.view.RichTextView
|
||||
style="@style/SudDescription.Glif"
|
||||
android:id="@+id/title"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="start"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@+id/toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/sud_description_text_size"
|
||||
/>
|
||||
|
||||
<!-- Subtitle -->
|
||||
<TextView
|
||||
@@ -50,7 +53,8 @@
|
||||
android:layout_below="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"/>
|
||||
android:text="@string/security_settings_face_enroll_introduction_accessibility_expanded"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<!-- Vertical divider -->
|
||||
<View
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
style="?attr/face_layout_theme"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
app:sucHeaderText="@string/security_settings_face_enroll_education_title">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SudContentFrame"
|
||||
@@ -38,7 +39,7 @@
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-32dp">
|
||||
android:layout_marginTop="-24dp">
|
||||
|
||||
<com.google.android.setupdesign.view.IllustrationVideoView
|
||||
android:id="@+id/illustration_default"
|
||||
@@ -97,7 +98,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:messageText="@string/security_settings_face_enroll_introduction_accessibility_diversity"/>
|
||||
app:messageText="@string/security_settings_face_enroll_introduction_accessibility"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
@@ -24,39 +24,40 @@
|
||||
android:id="@+id/pinned_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="2dp"
|
||||
settings:layout_constraintTop_toTopOf="parent"/>
|
||||
android:elevation="2dp"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/apps_list"
|
||||
<FrameLayout
|
||||
android:id="@+id/list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="none"
|
||||
android:visibility="invisible"
|
||||
settings:fastScrollEnabled="true"
|
||||
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
||||
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
||||
settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
|
||||
settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"
|
||||
settings:layout_constraintTop_toBottomOf="@id/pinned_header"
|
||||
settings:layout_constraintBottom_toBottomOf="parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_applications"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:visibility="invisible"
|
||||
settings:layout_constraintTop_toTopOf="parent"
|
||||
settings:layout_constraintBottom_toBottomOf="parent"/>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/apps_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="none"
|
||||
settings:fastScrollEnabled="true"
|
||||
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
|
||||
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
|
||||
settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
|
||||
settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
|
||||
|
||||
<include layout="@layout/loading_container"
|
||||
settings:layout_constraintTop_toBottomOf="@id/pinned_header"
|
||||
settings:layout_constraintBottom_toBottomOf="parent"/>
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/no_applications"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/loading_container"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
android:id="@+id/panel_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/settings_panel_background" >
|
||||
android:background="@drawable/settings_panel_rounded_top_corner_background" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -30,7 +30,11 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/panel_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="94dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/settings_panel_title_margin"
|
||||
android:layout_marginEnd="@dimen/settings_panel_title_margin"
|
||||
android:layout_marginTop="@dimen/settings_panel_title_margin"
|
||||
android:layout_marginBottom="@dimen/settings_panel_title_margin"
|
||||
android:gravity="start|center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
@@ -51,14 +55,13 @@
|
||||
android:id="@+id/header_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
@@ -81,11 +84,12 @@
|
||||
android:id="@+id/panel_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_panel_title_margin"
|
||||
android:layout_marginBottom="@dimen/settings_panel_title_margin"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingTop="18dp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
android:textSize="24sp"
|
||||
android:fontFamily="sans-serif-reqular"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/container_material"
|
||||
android:orientation="vertical"
|
||||
@@ -66,19 +67,20 @@
|
||||
android:background="@android:color/transparent"
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layoutDirection="ltr"
|
||||
app:tabMaxWidth="0dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
app:tabIndicatorColor="@*android:color/accent_device_default"
|
||||
app:tabIndicator="@drawable/tabs_indicator_background"
|
||||
app:tabIndicatorColor="?androidprv:attr/colorAccentPrimaryVariant"
|
||||
app:tabSelectedTextColor="@*android:color/accent_device_default"
|
||||
app:tabTextAppearance="@style/TextAppearance.Tab"
|
||||
app:tabTextColor="?android:attr/textColorSecondary"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
|
||||
@@ -149,6 +149,8 @@
|
||||
<dimen name="wifi_assistant_height">182dp</dimen>
|
||||
<dimen name="wifi_assistant_image_top">32dp</dimen>
|
||||
<dimen name="wifi_assistant_image_start">24dp</dimen>
|
||||
<!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
|
||||
<dimen name="app_bar_height">80dp</dimen>
|
||||
|
||||
<!-- CryptKeeper top margin for password/pin screen -->
|
||||
<dimen name="crypt_keeper_password_top_margin">88dip</dimen>
|
||||
@@ -425,6 +427,10 @@
|
||||
<dimen name="output_switcher_panel_icon_size">52dp</dimen>
|
||||
<dimen name="output_switcher_panel_icon_corner_radius">16dp</dimen>
|
||||
|
||||
<!-- Settings panel related dimensions -->
|
||||
<dimen name="settings_panel_corner_radius">28dp</dimen>
|
||||
<dimen name="settings_panel_title_margin">24dp</dimen>
|
||||
|
||||
<!-- Text padding for EmptyTextSettings -->
|
||||
<dimen name="empty_text_padding">24dp</dimen>
|
||||
|
||||
|
||||
@@ -6825,7 +6825,7 @@
|
||||
<!-- Title of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
|
||||
<string name="ca_certificate_warning_title">Your data won\u2019t be private</string>
|
||||
<!-- Description of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
|
||||
<string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
|
||||
<string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\nIf you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
|
||||
<!-- Label for button to not install a certificate [CHAR_LIMIT=50] -->
|
||||
<string name="certificate_warning_dont_install">Don\u2019t install</string>
|
||||
<!-- Label for button to continue installing a certificate [CHAR_LIMIT=50] -->
|
||||
|
||||
@@ -368,7 +368,12 @@ public class AppStorageSettings extends AppInfoWithHeader
|
||||
}
|
||||
ActivityManager am = (ActivityManager)
|
||||
getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
||||
boolean res = am.clearApplicationUserData(packageName, mClearDataObserver);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = am.clearApplicationUserData(packageName, mClearDataObserver);
|
||||
} catch (SecurityException e) {
|
||||
Log.i(TAG, "Failed to clear application user data: " + e);
|
||||
}
|
||||
if (!res) {
|
||||
// Clearing data failed for some obscure reason. Just log error for now
|
||||
Log.i(TAG, "Couldn't clear application user data for package:" + packageName);
|
||||
|
||||
@@ -72,11 +72,7 @@ public class RunningServices extends SettingsPreferenceFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
boolean haveData = mRunningProcessesView.doResume(this, mRunningProcessesAvail);
|
||||
if (haveData) {
|
||||
mLoadingViewController.showContent(false /* animate */);
|
||||
} else {
|
||||
mLoadingViewController.showLoadingView();
|
||||
}
|
||||
mLoadingViewController.handleLoadingContainer(haveData /* done */, false /* animate */);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -208,6 +208,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
private ApplicationsAdapter mApplications;
|
||||
|
||||
private View mLoadingContainer;
|
||||
private View mListContainer;
|
||||
private SearchView mSearchView;
|
||||
|
||||
// Size resource used for packages whose size computation failed for some reason
|
||||
@@ -401,21 +402,25 @@ public class ManageApplications extends InstrumentedFragment
|
||||
|
||||
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
|
||||
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
|
||||
mEmptyView = mRootView.findViewById(android.R.id.empty);
|
||||
mRecyclerView = mRootView.findViewById(R.id.apps_list);
|
||||
mListContainer = mRootView.findViewById(R.id.list_container);
|
||||
if (mListContainer != null) {
|
||||
// Create adapter and list view here
|
||||
mEmptyView = mListContainer.findViewById(android.R.id.empty);
|
||||
|
||||
mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
|
||||
savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
mApplications.mHasReceivedLoadEntries =
|
||||
savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
|
||||
mApplications.mHasReceivedBridgeCallback =
|
||||
savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
|
||||
mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
|
||||
savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
mApplications.mHasReceivedLoadEntries =
|
||||
savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
|
||||
mApplications.mHasReceivedBridgeCallback =
|
||||
savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
|
||||
}
|
||||
mRecyclerView = mListContainer.findViewById(R.id.apps_list);
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(
|
||||
getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
|
||||
mRecyclerView.setAdapter(mApplications);
|
||||
}
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(
|
||||
getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
|
||||
mRecyclerView.setAdapter(mApplications);
|
||||
|
||||
// We have to do this now because PreferenceFrameLayout looks at it
|
||||
// only when the view is added.
|
||||
@@ -980,8 +985,16 @@ public class ManageApplications extends InstrumentedFragment
|
||||
// overlapped by floating filter.
|
||||
if (hasFilter) {
|
||||
mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
|
||||
mManageApplications.mRecyclerView.setPadding(0 /* left */,
|
||||
mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.app_bar_height) /* top */,
|
||||
0 /* right */,
|
||||
0 /* bottom */);
|
||||
} else {
|
||||
mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
|
||||
mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
|
||||
0 /* right */,
|
||||
0 /* bottom */);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1031,8 +1044,7 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mManageApplications = manageApplications;
|
||||
mLoadingViewController = new LoadingViewController(
|
||||
mManageApplications.mLoadingContainer,
|
||||
mManageApplications.mRecyclerView,
|
||||
mManageApplications.mEmptyView
|
||||
mManageApplications.mListContainer
|
||||
);
|
||||
mContext = manageApplications.getActivity();
|
||||
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
|
||||
@@ -1291,9 +1303,11 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mOriginalEntries = entries;
|
||||
notifyDataSetChanged();
|
||||
if (getItemCount() == 0) {
|
||||
mLoadingViewController.showEmpty(false /* animate */);
|
||||
mManageApplications.mRecyclerView.setVisibility(View.GONE);
|
||||
mManageApplications.mEmptyView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mLoadingViewController.showContent(false /* animate */);
|
||||
mManageApplications.mEmptyView.setVisibility(View.GONE);
|
||||
mManageApplications.mRecyclerView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (mManageApplications.mSearchView != null
|
||||
&& mManageApplications.mSearchView.isVisibleToUser()) {
|
||||
@@ -1310,6 +1324,10 @@ public class ManageApplications extends InstrumentedFragment
|
||||
mLastIndex = -1;
|
||||
}
|
||||
|
||||
if (mSession.getAllApps().size() != 0
|
||||
&& mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
|
||||
mLoadingViewController.showContent(true /* animate */);
|
||||
}
|
||||
if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
|
||||
// No enabled or disabled filters for usage access.
|
||||
return;
|
||||
|
||||
@@ -16,20 +16,17 @@
|
||||
|
||||
package com.android.settings.biometrics.face;
|
||||
|
||||
import android.annotation.StringRes;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
@@ -41,14 +38,10 @@ import com.airbnb.lottie.LottieAnimationView;
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
import com.google.android.setupdesign.view.IllustrationVideoView;
|
||||
|
||||
public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||
|
||||
private static final String TAG = "FaceEducation";
|
||||
private static final int ON = 1;
|
||||
private static final int OFF = 0;
|
||||
|
||||
private FaceManager mFaceManager;
|
||||
private FaceEnrollAccessibilityToggle mSwitchDiversity;
|
||||
@@ -57,28 +50,18 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||
private IllustrationVideoView mIllustrationDefault;
|
||||
private LottieAnimationView mIllustrationLottie;
|
||||
private View mIllustrationAccessibility;
|
||||
private Handler mHandler;
|
||||
private Intent mResultIntent;
|
||||
private TextView mDescriptionText;
|
||||
private boolean mNextClicked;
|
||||
private boolean mAccessibilityEnabled;
|
||||
|
||||
private CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
||||
private final CompoundButton.OnCheckedChangeListener mSwitchDiversityListener =
|
||||
new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
final int headerRes;
|
||||
final int descriptionRes;
|
||||
if (isChecked) {
|
||||
headerRes = R.string
|
||||
.security_settings_face_enroll_education_title_accessibility;
|
||||
descriptionRes = R.string
|
||||
.security_settings_face_enroll_education_message_accessibility;
|
||||
} else {
|
||||
headerRes = R.string.security_settings_face_enroll_education_title;
|
||||
descriptionRes = R.string.security_settings_face_enroll_education_message;
|
||||
}
|
||||
updateHeaders(headerRes, descriptionRes);
|
||||
final int descriptionRes = isChecked
|
||||
? R.string.security_settings_face_enroll_education_message_accessibility
|
||||
: R.string.security_settings_face_enroll_education_message;
|
||||
setDescriptionText(descriptionRes);
|
||||
|
||||
if (isChecked) {
|
||||
hideDefaultIllustration();
|
||||
@@ -95,18 +78,14 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.face_enroll_education);
|
||||
|
||||
final int headerRes = R.string.security_settings_face_enroll_education_title;
|
||||
final int descriptionRes = R.string.security_settings_face_enroll_education_message;
|
||||
updateHeaders(headerRes, descriptionRes);
|
||||
|
||||
mHandler = new Handler();
|
||||
setTitle(R.string.security_settings_face_enroll_education_title);
|
||||
setDescriptionText(R.string.security_settings_face_enroll_education_message);
|
||||
|
||||
mFaceManager = Utils.getFaceManagerOrNull(this);
|
||||
|
||||
mIllustrationDefault = findViewById(R.id.illustration_default);
|
||||
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
|
||||
mDescriptionText = findViewById(R.id.sud_layout_description);
|
||||
|
||||
mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
|
||||
if (mIsUsingLottie) {
|
||||
@@ -259,15 +238,6 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
||||
return SettingsEnums.FACE_ENROLL_INTRO;
|
||||
}
|
||||
|
||||
private void updateHeaders(@StringRes int headerRes, @StringRes int descriptionRes) {
|
||||
final CharSequence headerText = getText(headerRes);
|
||||
setTitle(headerText);
|
||||
|
||||
final GlifLayout layout = getLayout();
|
||||
layout.setHeaderText(headerText);
|
||||
layout.setDescriptionText(descriptionRes);
|
||||
}
|
||||
|
||||
private void hideDefaultIllustration() {
|
||||
if (mIsUsingLottie) {
|
||||
mIllustrationLottie.cancelAnimation();
|
||||
|
||||
@@ -221,7 +221,7 @@ public class BluetoothPermissionActivity extends AlertActivity implements
|
||||
intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always);
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
|
||||
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
|
||||
sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
|
||||
sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
@@ -293,6 +293,6 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
|
||||
: BluetoothDevice.CONNECTION_ACCESS_NO);
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
|
||||
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
|
||||
mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
|
||||
mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +212,6 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
}
|
||||
}
|
||||
|
||||
mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_ADMIN);
|
||||
mContext.sendBroadcast(intent, Manifest.permission.BLUETOOTH_CONNECT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
/** Base activity for Settings pages */
|
||||
public class SettingsBaseActivity extends FragmentActivity implements CategoryHandler {
|
||||
public class SettingsBaseActivity extends FragmentActivity implements CategoryHandler,
|
||||
AppBarLayout.OnOffsetChangedListener {
|
||||
|
||||
/**
|
||||
* What type of page transition should be apply.
|
||||
@@ -58,11 +59,15 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
protected static final boolean DEBUG_TIMING = false;
|
||||
private static final String TAG = "SettingsBaseActivity";
|
||||
private static final int DEFAULT_REQUEST = -1;
|
||||
private static final int FULLY_EXPANDED_OFFSET = 0;
|
||||
private static final int TOOLBAR_MAX_LINE_NUMBER = 2;
|
||||
private static final String KEY_IS_TOOLBAR_COLLAPSED = "is_toolbar_collapsed";
|
||||
|
||||
protected CategoryMixin mCategoryMixin;
|
||||
protected CollapsingToolbarLayout mCollapsingToolbarLayout;
|
||||
protected AppBarLayout mAppBarLayout;
|
||||
private Toolbar mToolbar;
|
||||
private boolean mIsToolbarCollapsed;
|
||||
|
||||
@Override
|
||||
public CategoryMixin getCategoryMixin() {
|
||||
@@ -100,6 +105,11 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
super.setContentView(R.layout.collapsing_toolbar_base_layout);
|
||||
mCollapsingToolbarLayout = findViewById(R.id.collapsing_toolbar);
|
||||
mAppBarLayout = findViewById(R.id.app_bar);
|
||||
mAppBarLayout.addOnOffsetChangedListener(this);
|
||||
if (savedInstanceState != null) {
|
||||
mIsToolbarCollapsed = savedInstanceState.getBoolean(KEY_IS_TOOLBAR_COLLAPSED);
|
||||
}
|
||||
initCollapsingToolbar();
|
||||
disableCollapsingToolbarLayoutScrollingBehavior();
|
||||
} else {
|
||||
super.setContentView(R.layout.settings_base_layout);
|
||||
@@ -191,6 +201,23 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int offset) {
|
||||
if (offset == FULLY_EXPANDED_OFFSET) {
|
||||
mIsToolbarCollapsed = false;
|
||||
} else {
|
||||
mIsToolbarCollapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (isChangingConfigurations()) {
|
||||
outState.putBoolean(KEY_IS_TOOLBAR_COLLAPSED, mIsToolbarCollapsed);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SubSetting page should show a toolbar by default. If the page wouldn't show a toolbar,
|
||||
* override this method and return false value.
|
||||
@@ -238,6 +265,9 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
}
|
||||
|
||||
private void disableCollapsingToolbarLayoutScrollingBehavior() {
|
||||
if (mAppBarLayout == null) {
|
||||
return;
|
||||
}
|
||||
final CoordinatorLayout.LayoutParams params =
|
||||
(CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
|
||||
final AppBarLayout.Behavior behavior = new AppBarLayout.Behavior();
|
||||
@@ -254,4 +284,39 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
||||
private int getTransitionType(Intent intent) {
|
||||
return intent.getIntExtra(EXTRA_PAGE_TRANSITION_TYPE, TransitionType.TRANSITION_NONE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("RestrictTo")
|
||||
private void initCollapsingToolbar() {
|
||||
if (mCollapsingToolbarLayout == null || mAppBarLayout == null) {
|
||||
return;
|
||||
}
|
||||
mCollapsingToolbarLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
v.removeOnLayoutChangeListener(this);
|
||||
if (mIsToolbarCollapsed) {
|
||||
return;
|
||||
}
|
||||
final int count = mCollapsingToolbarLayout.getLineCount();
|
||||
if (count > TOOLBAR_MAX_LINE_NUMBER) {
|
||||
final ViewGroup.LayoutParams lp = mCollapsingToolbarLayout.getLayoutParams();
|
||||
lp.height = getResources()
|
||||
.getDimensionPixelSize(R.dimen.toolbar_three_lines_height);
|
||||
mCollapsingToolbarLayout.setScrimVisibleHeightTrigger(
|
||||
getResources().getDimensionPixelSize(
|
||||
R.dimen.scrim_visible_height_trigger_three_lines));
|
||||
mCollapsingToolbarLayout.setLayoutParams(lp);
|
||||
} else if (count == TOOLBAR_MAX_LINE_NUMBER) {
|
||||
final ViewGroup.LayoutParams lp = mCollapsingToolbarLayout.getLayoutParams();
|
||||
lp.height = getResources()
|
||||
.getDimensionPixelSize(R.dimen.toolbar_two_lines_height);
|
||||
mCollapsingToolbarLayout.setScrimVisibleHeightTrigger(
|
||||
getResources().getDimensionPixelSize(
|
||||
R.dimen.scrim_visible_height_trigger_two_lines));
|
||||
mCollapsingToolbarLayout.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class BatteryInfo {
|
||||
}
|
||||
final long prediction = discharging ? batteryUsageStats.getBatteryTimeRemainingMs() : 0;
|
||||
final Estimate estimate = new Estimate(
|
||||
PowerUtil.convertUsToMs(prediction),
|
||||
prediction,
|
||||
false, /* isBasedOnUsage */
|
||||
EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN);
|
||||
BatteryUtils.logRuntime(LOG_TAG, "time for regular BatteryInfo", startTime);
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -112,7 +113,6 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false);
|
||||
final boolean forBiometrics = intent
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
|
||||
|
||||
final SetupSkipDialog dialog = SetupSkipDialog.newInstance(
|
||||
frpSupported,
|
||||
/* isPatternMode= */ false,
|
||||
@@ -120,6 +120,11 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
||||
forFingerprint,
|
||||
forFace,
|
||||
forBiometrics);
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
|
||||
Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
|
||||
dialog.show(getFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
@@ -190,12 +192,21 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int button) {
|
||||
Activity activity = getActivity();
|
||||
switch (button) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
Activity activity = getActivity();
|
||||
activity.setResult(RESULT_SKIP);
|
||||
activity.finish();
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
View view = activity.getCurrentFocus();
|
||||
if(view != null) {
|
||||
view.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) activity
|
||||
.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,12 @@ import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
|
||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||
import com.google.android.setupcompat.template.FooterButton;
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
/**
|
||||
* Creates a warning dialog explaining the consequences of installing a CA certificate
|
||||
@@ -40,8 +42,11 @@ public class InstallCaCertificateWarning extends Activity {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||
ThemeHelper.trySetDynamicColor(this);
|
||||
setContentView(R.layout.ca_certificate_warning_dialog);
|
||||
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
|
||||
layout.setHeaderText(R.string.ca_certificate_warning_title);
|
||||
|
||||
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
|
||||
mixin.setSecondaryButton(
|
||||
|
||||
@@ -22,66 +22,34 @@ import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A helper class that manages show/hide loading spinner, content view and empty view (optional).
|
||||
* A helper class that manages show/hide loading spinner.
|
||||
*/
|
||||
public class LoadingViewController {
|
||||
|
||||
private static final long DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS = 100L;
|
||||
|
||||
private final Handler mFgHandler;
|
||||
private final View mLoadingView;
|
||||
private final View mContentView;
|
||||
private final View mEmptyView;
|
||||
public final Handler mFgHandler;
|
||||
public final View mLoadingView;
|
||||
public final View mContentView;
|
||||
|
||||
public LoadingViewController(View loadingView, View contentView) {
|
||||
this(loadingView, contentView, null /* emptyView*/);
|
||||
}
|
||||
|
||||
public LoadingViewController(View loadingView, View contentView, @Nullable View emptyView) {
|
||||
mLoadingView = loadingView;
|
||||
mContentView = contentView;
|
||||
mEmptyView = emptyView;
|
||||
mFgHandler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
private Runnable mShowLoadingContainerRunnable = new Runnable() {
|
||||
public void run() {
|
||||
showLoadingView();
|
||||
handleLoadingContainer(false /* done */, false /* animate */);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows content view and hides loading view & empty view.
|
||||
*/
|
||||
public void showContent(boolean animate) {
|
||||
// Cancel any pending task to show the loading animation and show the list of
|
||||
// apps directly.
|
||||
mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
|
||||
handleLoadingContainer(true /* showContent */, false /* showEmpty*/, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows empty view and hides loading view & content view.
|
||||
*/
|
||||
public void showEmpty(boolean animate) {
|
||||
if (mEmptyView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel any pending task to show the loading animation and show the list of
|
||||
// apps directly.
|
||||
mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
|
||||
handleLoadingContainer(false /* showContent */, true /* showEmpty */, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows loading view and hides content view & empty view.
|
||||
*/
|
||||
public void showLoadingView() {
|
||||
handleLoadingContainer(false /* showContent */, false /* showEmpty */, false /* animate */);
|
||||
handleLoadingContainer(true /* show */, animate);
|
||||
}
|
||||
|
||||
public void showLoadingViewDelayed() {
|
||||
@@ -89,9 +57,8 @@ public class LoadingViewController {
|
||||
mShowLoadingContainerRunnable, DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS);
|
||||
}
|
||||
|
||||
private void handleLoadingContainer(boolean showContent, boolean showEmpty, boolean animate) {
|
||||
handleLoadingContainer(mLoadingView, mContentView, mEmptyView,
|
||||
showContent, showEmpty, animate);
|
||||
public void handleLoadingContainer(boolean done, boolean animate) {
|
||||
handleLoadingContainer(mLoadingView, mContentView, done, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,25 +75,6 @@ public class LoadingViewController {
|
||||
setViewShown(content, done, animate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show/hide loading view and content view and empty view.
|
||||
*
|
||||
* @param loading The loading spinner view
|
||||
* @param content The content view
|
||||
* @param empty The empty view shows no item summary to users.
|
||||
* @param showContent If true, content is set visible and loading is set invisible.
|
||||
* @param showEmpty If true, empty is set visible and loading is set invisible.
|
||||
* @param animate Whether or not content/loading views should animate in/out.
|
||||
*/
|
||||
public static void handleLoadingContainer(View loading, View content, View empty,
|
||||
boolean showContent, boolean showEmpty, boolean animate) {
|
||||
if (empty != null) {
|
||||
setViewShown(empty, showEmpty, animate);
|
||||
}
|
||||
setViewShown(content, showContent, animate);
|
||||
setViewShown(loading, !showContent && !showEmpty, animate);
|
||||
}
|
||||
|
||||
private static void setViewShown(final View view, boolean shown, boolean animate) {
|
||||
if (animate) {
|
||||
Animation animation = AnimationUtils.loadAnimation(view.getContext(),
|
||||
|
||||
@@ -142,11 +142,7 @@ public class WifiPickerTrackerHelper implements LifecycleObserver {
|
||||
/** Confirms connection of the carrier network connected with the internet access */
|
||||
public boolean isCarrierNetworkActive() {
|
||||
final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
|
||||
if (mergedCarrierEntry != null) {
|
||||
return mergedCarrierEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED
|
||||
&& mergedCarrierEntry.hasInternetAccess();
|
||||
}
|
||||
return false;
|
||||
return (mergedCarrierEntry != null && mergedCarrierEntry.isDefaultNetwork());
|
||||
}
|
||||
|
||||
/** Return the carrier network ssid */
|
||||
|
||||
@@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -48,6 +49,7 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SearchView;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@@ -153,6 +155,22 @@ public class ManageApplicationsTest {
|
||||
assertThat(mMenu.findItem(R.id.sort_order_frequent_notification).isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCreateView_shouldNotShowLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mResetAppsHelper", mock(ResetAppsHelper.class));
|
||||
doNothing().when(mFragment).createHeader();
|
||||
|
||||
final LayoutInflater layoutInflater = mock(LayoutInflater.class);
|
||||
final View view = mock(View.class);
|
||||
final View loadingContainer = mock(View.class);
|
||||
when(layoutInflater.inflate(anyInt(), eq(null))).thenReturn(view);
|
||||
when(view.findViewById(R.id.loading_container)).thenReturn(loadingContainer);
|
||||
|
||||
mFragment.onCreateView(layoutInflater, mock(ViewGroup.class), null);
|
||||
|
||||
verify(loadingContainer, never()).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onCreateOptionsMenu_shouldSetSearchQueryListener() {
|
||||
final SearchView searchView = mock(SearchView.class);
|
||||
@@ -203,6 +221,7 @@ public class ManageApplicationsTest {
|
||||
@Test
|
||||
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -224,6 +243,7 @@ public class ManageApplicationsTest {
|
||||
@Test
|
||||
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -252,6 +272,7 @@ public class ManageApplicationsTest {
|
||||
when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
|
||||
when(listContainer.getContext()).thenReturn(context);
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
|
||||
final ManageApplications.ApplicationsAdapter adapter =
|
||||
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
|
||||
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
|
||||
@@ -275,7 +296,7 @@ public class ManageApplicationsTest {
|
||||
|
||||
adapter.onRebuildComplete(null);
|
||||
|
||||
verify(loadingViewController).showEmpty(false /* animate */);
|
||||
verify(loadingViewController).showContent(true /* animate */);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -283,16 +304,15 @@ public class ManageApplicationsTest {
|
||||
final String query = "Test";
|
||||
final RecyclerView recyclerView = mock(RecyclerView.class);
|
||||
final View emptyView = mock(View.class);
|
||||
final View loadingContainer = mock(View.class);
|
||||
ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
|
||||
ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
|
||||
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
|
||||
final SearchView searchView = mock(SearchView.class);
|
||||
ReflectionHelpers.setField(mFragment, "mSearchView", searchView);
|
||||
when(searchView.isVisibleToUser()).thenReturn(true);
|
||||
when(searchView.getQuery()).thenReturn(query);
|
||||
final View listContainer = mock(View.class);
|
||||
when(listContainer.getVisibility()).thenReturn(View.VISIBLE);
|
||||
ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
|
||||
ReflectionHelpers.setField(
|
||||
mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
|
||||
final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
|
||||
@@ -471,6 +491,8 @@ public class ManageApplicationsTest {
|
||||
mFragment.mFilterAdapter.updateFilterView(true);
|
||||
|
||||
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -53,6 +53,6 @@ public class BluetoothPermissionActivityTest {
|
||||
mActivity.sendReplyIntentToReceiver(true, true);
|
||||
|
||||
verify(mContext).sendBroadcast(intentCaptor.capture(),
|
||||
eq("android.permission.BLUETOOTH_ADMIN"));
|
||||
eq("android.permission.BLUETOOTH_CONNECT"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class DevicePickerFragmentTest {
|
||||
mFragment.onDeviceBondStateChanged(cachedDevice, BluetoothDevice.BOND_BONDED);
|
||||
|
||||
verify(mContext).sendBroadcast(intentCaptor.capture(),
|
||||
eq("android.permission.BLUETOOTH_ADMIN"));
|
||||
eq("android.permission.BLUETOOTH_CONNECT"));
|
||||
assertThat(intentCaptor.getValue().getComponent().getPackageName())
|
||||
.isEqualTo(mFragment.mLaunchPackage);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.robolectric.RuntimeEnvironment.application;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -55,6 +56,7 @@ import org.robolectric.annotation.Implementation;
|
||||
import org.robolectric.annotation.Implements;
|
||||
import org.robolectric.shadows.ShadowActivity;
|
||||
import org.robolectric.shadows.ShadowDialog;
|
||||
import org.robolectric.shadows.ShadowInputMethodManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -149,6 +151,9 @@ public class SetupChooseLockPasswordTest {
|
||||
@Test
|
||||
public void createActivity_skipButtonInIntroductionStage_shouldBeVisible() {
|
||||
SetupChooseLockPassword activity = createSetupChooseLockPassword();
|
||||
final InputMethodManager inputMethodManager = activity
|
||||
.getSystemService(InputMethodManager.class);
|
||||
final ShadowInputMethodManager shadowImm = Shadows.shadowOf(inputMethodManager);
|
||||
|
||||
final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
|
||||
final Button skipOrClearButton =
|
||||
@@ -159,6 +164,7 @@ public class SetupChooseLockPasswordTest {
|
||||
skipOrClearButton.performClick();
|
||||
final AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||
assertThat(chooserDialog).isNotNull();
|
||||
assertThat(shadowImm.isSoftInputVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user