Fix DataSaverBackend objects created on background threads
Add the main looper to the handler created with each DataSaverBackend to avoid crashes when the objects are created on background threads. Bug: 62022517 Test: make RunSettingsRoboTests Change-Id: I7396107e4ed06982c8cd300912ce1f4e3c63df4c Merged-In: Ie5ffabbfbe7660761527b3ecd51e6bc5a43c1ace
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.android.settings.testutils.shadow;
|
||||
|
||||
import com.android.settings.datausage.DataSaverBackend;
|
||||
import org.robolectric.annotation.Implementation;
|
||||
import org.robolectric.annotation.Implements;
|
||||
|
||||
@Implements(DataSaverBackend.class)
|
||||
public class ShadowDataSaverBackend {
|
||||
|
||||
private static boolean isEnabled = true;
|
||||
|
||||
@Implementation
|
||||
public boolean isDataSaverEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public void setDataSaverEnabled(boolean enabled) {
|
||||
isEnabled = enabled;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user