Merge "Turn on feature flag to use bugreport API by default"
diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml
index f485c6a..94052b6 100644
--- a/res/xml/bluetooth_device_details_fragment.xml
+++ b/res/xml/bluetooth_device_details_fragment.xml
@@ -47,4 +47,10 @@
<PreferenceCategory
android:key="bluetooth_profiles"/>
+ <com.android.settingslib.widget.FooterPreference
+ android:key="device_details_footer"
+ android:selectable="false"
+ settings:searchable="false"
+ settings:controller="com.android.settings.bluetooth.BluetoothDetailsMacAddressController"/>
+
</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index a652056..992cc67 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -42,7 +42,6 @@
import android.view.MenuInflater;
import android.view.MenuItem;
-import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
@@ -460,7 +459,8 @@
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
}
if (syncIsFailing) {
- createFooterPreference();
+ getPreferenceScreen().addPreference(new FooterPreference.Builder(
+ getActivity()).setTitle(R.string.sync_is_failing).build());
}
}
@@ -553,11 +553,4 @@
| DateUtils.FORMAT_SHOW_YEAR
| DateUtils.FORMAT_SHOW_TIME);
}
-
- @VisibleForTesting
- void createFooterPreference() {
- final FooterPreference footerPreference = new FooterPreference(getActivity());
- footerPreference.setTitle(R.string.sync_is_failing);
- getPreferenceScreen().addPreference(footerPreference);
- }
}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index c90a0de..68b21f5 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -141,56 +141,57 @@
private HashMap<Integer, String> mFingerprintsRenaming;
FingerprintAuthenticateSidecar.Listener mAuthenticateListener =
- new FingerprintAuthenticateSidecar.Listener() {
- @Override
- public void onAuthenticationSucceeded(
- FingerprintManager.AuthenticationResult result) {
- int fingerId = result.getFingerprint().getBiometricId();
- mHandler.obtainMessage(MSG_FINGER_AUTH_SUCCESS, fingerId, 0).sendToTarget();
- }
+ new FingerprintAuthenticateSidecar.Listener() {
+ @Override
+ public void onAuthenticationSucceeded(
+ FingerprintManager.AuthenticationResult result) {
+ int fingerId = result.getFingerprint().getBiometricId();
+ mHandler.obtainMessage(MSG_FINGER_AUTH_SUCCESS, fingerId, 0).sendToTarget();
+ }
- @Override
- public void onAuthenticationFailed() {
- mHandler.obtainMessage(MSG_FINGER_AUTH_FAIL).sendToTarget();
- }
+ @Override
+ public void onAuthenticationFailed() {
+ mHandler.obtainMessage(MSG_FINGER_AUTH_FAIL).sendToTarget();
+ }
- @Override
- public void onAuthenticationError(int errMsgId, CharSequence errString) {
- mHandler.obtainMessage(MSG_FINGER_AUTH_ERROR, errMsgId, 0, errString)
- .sendToTarget();
- }
+ @Override
+ public void onAuthenticationError(int errMsgId, CharSequence errString) {
+ mHandler.obtainMessage(MSG_FINGER_AUTH_ERROR, errMsgId, 0, errString)
+ .sendToTarget();
+ }
- @Override
- public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
- mHandler.obtainMessage(MSG_FINGER_AUTH_HELP, helpMsgId, 0, helpString)
- .sendToTarget();
- }
- };
+ @Override
+ public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
+ mHandler.obtainMessage(MSG_FINGER_AUTH_HELP, helpMsgId, 0, helpString)
+ .sendToTarget();
+ }
+ };
FingerprintRemoveSidecar.Listener mRemovalListener =
new FingerprintRemoveSidecar.Listener() {
- public void onRemovalSucceeded(Fingerprint fingerprint) {
- mHandler.obtainMessage(MSG_REFRESH_FINGERPRINT_TEMPLATES,
- fingerprint.getBiometricId(), 0).sendToTarget();
- updateDialog();
- }
+ public void onRemovalSucceeded(Fingerprint fingerprint) {
+ mHandler.obtainMessage(MSG_REFRESH_FINGERPRINT_TEMPLATES,
+ fingerprint.getBiometricId(), 0).sendToTarget();
+ updateDialog();
+ }
- public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence errString) {
- final Activity activity = getActivity();
- if (activity != null) {
- Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
- }
- updateDialog();
- }
+ public void onRemovalError(Fingerprint fp, int errMsgId,
+ CharSequence errString) {
+ final Activity activity = getActivity();
+ if (activity != null) {
+ Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
+ }
+ updateDialog();
+ }
- private void updateDialog() {
- RenameDialog renameDialog = (RenameDialog) getFragmentManager().
- findFragmentByTag(RenameDialog.class.getName());
- if (renameDialog != null) {
- renameDialog.enableDelete();
- }
- }
- };
+ private void updateDialog() {
+ RenameDialog renameDialog = (RenameDialog) getFragmentManager().
+ findFragmentByTag(RenameDialog.class.getName());
+ if (renameDialog != null) {
+ renameDialog.enableDelete();
+ }
+ }
+ };
private final Handler mHandler = new Handler() {
@Override
@@ -200,17 +201,17 @@
removeFingerprintPreference(msg.arg1);
updateAddPreference();
retryFingerprint();
- break;
+ break;
case MSG_FINGER_AUTH_SUCCESS:
highlightFingerprintItem(msg.arg1);
retryFingerprint();
- break;
+ break;
case MSG_FINGER_AUTH_FAIL:
// No action required... fingerprint will allow up to 5 of these
- break;
+ break;
case MSG_FINGER_AUTH_ERROR:
- handleError(msg.arg1 /* errMsgId */, (CharSequence) msg.obj /* errStr */ );
- break;
+ handleError(msg.arg1 /* errMsgId */, (CharSequence) msg.obj /* errStr */);
+ break;
case MSG_FINGER_AUTH_HELP: {
// Not used
}
@@ -220,7 +221,7 @@
};
/**
- * @param errMsgId
+ *
*/
protected void handleError(int errMsgId, CharSequence msg) {
switch (errMsgId) {
@@ -243,7 +244,7 @@
// Activity can be null on a screen rotation.
final Activity activity = getActivity();
if (activity != null) {
- Toast.makeText(activity, msg , Toast.LENGTH_SHORT).show();
+ Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
}
}
retryFingerprint(); // start again
@@ -425,11 +426,8 @@
if (context == null) {
return;
}
-
- final FooterPreference footerPreference = new FooterPreference(context);
- footerPreference.setTitle(mFooterTitle);
- footerPreference.setSelectable(false);
- root.addPreference(footerPreference);
+ root.addPreference(new FooterPreference.Builder(context).setTitle(
+ mFooterTitle).build());
}
private static String genKey(int id) {
@@ -522,7 +520,8 @@
RenameDialog renameDialog = new RenameDialog();
Bundle args = new Bundle();
if (mFingerprintsRenaming.containsKey(fp.getBiometricId())) {
- final Fingerprint f = new Fingerprint(mFingerprintsRenaming.get(fp.getBiometricId()),
+ final Fingerprint f = new Fingerprint(
+ mFingerprintsRenaming.get(fp.getBiometricId()),
fp.getGroupId(), fp.getBiometricId(), fp.getDeviceId());
args.putParcelable("fingerprint", f);
} else {
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
index 835961d..86c45bb 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
@@ -25,13 +25,13 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.FooterPreference;
-import com.android.settingslib.widget.FooterPreferenceMixinCompat;
/**
* This class adds the device MAC address to a footer.
*/
public class BluetoothDetailsMacAddressController extends BluetoothDetailsController {
- FooterPreferenceMixinCompat mFooterPreferenceMixin;
+ public static final String KEY_DEVICE_DETAILS_FOOTER = "device_details_footer";
+
FooterPreference mFooterPreference;
public BluetoothDetailsMacAddressController(Context context,
@@ -39,12 +39,11 @@
CachedBluetoothDevice device,
Lifecycle lifecycle) {
super(context, fragment, device, lifecycle);
- mFooterPreferenceMixin = new FooterPreferenceMixinCompat(fragment, lifecycle);
}
@Override
protected void init(PreferenceScreen screen) {
- mFooterPreference = mFooterPreferenceMixin.createFooterPreference();
+ mFooterPreference = screen.findPreference(KEY_DEVICE_DETAILS_FOOTER);
mFooterPreference.setTitle(mContext.getString(
R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
}
@@ -57,9 +56,6 @@
@Override
public String getPreferenceKey() {
- if (mFooterPreference == null) {
- return null;
- }
- return mFooterPreference.getKey();
+ return KEY_DEVICE_DETAILS_FOOTER;
}
}
\ No newline at end of file
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index c9cec57..9dab2bd 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -66,7 +66,6 @@
private static final int STORAGE_JOB_ID = 0;
private static final int ICON_JOB_ID = 1;
private static final int VOLUME_SIZE_JOB_ID = 2;
- private static final int OPTIONS_MENU_MIGRATE_DATA = 100;
private VolumeInfo mVolume;
private PrivateStorageInfo mStorageInfo;
@@ -139,6 +138,7 @@
}
private void onReceivedSizes() {
+ boolean stopLoading = false;
if (mStorageInfo != null) {
long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
@@ -152,18 +152,21 @@
userController.setTotalSize(mStorageInfo.totalBytes);
}
}
+ stopLoading = true;
+
}
- if (mAppsResult == null) {
- return;
+ if (mAppsResult != null) {
+ mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
+ updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
+ stopLoading = true;
}
- mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
- updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
-
// setLoading always causes a flicker, so let's avoid doing it.
- if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
- setLoading(false, true);
+ if (stopLoading) {
+ if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
+ setLoading(false, true);
+ }
}
}
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
index 59d1f60..dd1778f 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountSyncSettingsTest.java
@@ -15,8 +15,6 @@
*/
package com.android.settings.accounts;
-import static com.google.common.truth.Truth.assertThat;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
@@ -26,9 +24,7 @@
import android.os.UserHandle;
import androidx.fragment.app.FragmentActivity;
-import androidx.preference.Preference;
-import com.android.settings.testutils.shadow.ShadowAuthenticationHelper;
import com.android.settings.testutils.shadow.ShadowContentResolver;
import org.junit.After;
@@ -37,7 +33,6 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import org.robolectric.shadows.androidx.fragment.FragmentController;
import org.robolectric.util.ReflectionHelpers;
@RunWith(RobolectricTestRunner.class)
@@ -62,18 +57,4 @@
settings.onPreferenceTreeClick(preference);
// no crash
}
-
- @Test
- @Config(shadows = {ShadowAuthenticationHelper.class})
- public void createFooterPreference_shouldReturnFooter() {
- final AccountSyncSettings settings = FragmentController.of(new AccountSyncSettings())
- .create()
- .get();
-
- settings.createFooterPreference();
-
- final Preference footer = settings.getPreferenceScreen().findPreference(
- "footer_preference");
- assertThat(footer).isNotNull();
- }
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
index 9798745..c7eb1bb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressControllerTest.java
@@ -15,6 +15,8 @@
*/
package com.android.settings.bluetooth;
+import static com.android.settings.bluetooth.BluetoothDetailsMacAddressController.KEY_DEVICE_DETAILS_FOOTER;
+
import static com.google.common.truth.Truth.assertThat;
import com.android.settingslib.widget.FooterPreference;
@@ -25,22 +27,24 @@
@RunWith(RobolectricTestRunner.class)
public class BluetoothDetailsMacAddressControllerTest extends BluetoothDetailsControllerTestBase {
+ private BluetoothDetailsMacAddressController mController;
- private BluetoothDetailsMacAddressController mController;
+ @Override
+ public void setUp() {
+ super.setUp();
+ mController =
+ new BluetoothDetailsMacAddressController(mContext, mFragment, mCachedDevice,
+ mLifecycle);
+ setupDevice(mDeviceConfig);
+ mScreen.addPreference(new FooterPreference.Builder(mContext).setKey(
+ KEY_DEVICE_DETAILS_FOOTER).build());
+ }
- @Override
- public void setUp() {
- super.setUp();
- mController =
- new BluetoothDetailsMacAddressController(mContext, mFragment, mCachedDevice, mLifecycle);
- setupDevice(mDeviceConfig);
- }
-
- @Test
- public void macAddress() {
- showScreen(mController);
- FooterPreference footer =
- (FooterPreference) mScreen.findPreference(mController.getPreferenceKey());
- assertThat(footer.getTitle().toString()).endsWith(mDeviceConfig.getAddress());
- }
+ @Test
+ public void macAddress() {
+ showScreen(mController);
+ FooterPreference footer =
+ (FooterPreference) mScreen.findPreference(mController.getPreferenceKey());
+ assertThat(footer.getTitle().toString()).endsWith(mDeviceConfig.getAddress());
+ }
}