Snap for 9048375 from 19ee730df2
to tm-qpr1-release
Change-Id: I0d914865c3e90e8653260b8396899db62275e7e7
This commit is contained in:
@@ -83,6 +83,7 @@ android_library {
|
|||||||
"zxing-core-1.7",
|
"zxing-core-1.7",
|
||||||
"android.hardware.dumpstate-V1.0-java",
|
"android.hardware.dumpstate-V1.0-java",
|
||||||
"android.hardware.dumpstate-V1.1-java",
|
"android.hardware.dumpstate-V1.1-java",
|
||||||
|
"android.hardware.dumpstate-V1-java",
|
||||||
"lottie",
|
"lottie",
|
||||||
"WifiTrackerLib",
|
"WifiTrackerLib",
|
||||||
"SettingsLibActivityEmbedding",
|
"SettingsLibActivityEmbedding",
|
||||||
|
@@ -31,26 +31,16 @@
|
|||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false">
|
android:clipChildren="false">
|
||||||
|
|
||||||
|
<!-- Animation res MUST be set in code because asset is dependent on device orientation -->
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
<com.airbnb.lottie.LottieAnimationView
|
||||||
android:id="@+id/illustration_lottie"
|
android:id="@+id/illustration_lottie"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
app:lottie_imageAssetsFolder="images"
|
|
||||||
app:lottie_autoPlay="true"
|
|
||||||
app:lottie_loop="true"
|
|
||||||
app:lottie_rawRes="@raw/fingerprint_edu_lottie"/>
|
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
|
||||||
android:id="@+id/illustration_lottie_portrait"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:scaleType="centerInside"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:lottie_imageAssetsFolder="images"
|
app:lottie_imageAssetsFolder="images"
|
||||||
app:lottie_autoPlay="true"
|
app:lottie_autoPlay="true"
|
||||||
app:lottie_loop="true"
|
app:lottie_loop="true"/>
|
||||||
app:lottie_rawRes="@raw/fingerprint_edu_lottie_portrait"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.google.android.setupdesign.GlifLayout>
|
</com.google.android.setupdesign.GlifLayout>
|
||||||
|
File diff suppressed because one or more lines are too long
1
res/raw/fingerprint_edu_lottie_landscape_top_right.json
Normal file
1
res/raw/fingerprint_edu_lottie_landscape_top_right.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
res/raw/fingerprint_edu_lottie_portrait_top_left.json
Normal file
1
res/raw/fingerprint_edu_lottie_portrait_top_left.json
Normal file
File diff suppressed because one or more lines are too long
@@ -36,6 +36,7 @@ import com.android.settings.biometrics.BiometricEnrollBase;
|
|||||||
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
import com.android.settings.biometrics.BiometricEnrollSidecar;
|
||||||
import com.android.settings.biometrics.BiometricUtils;
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||||
|
import com.android.settingslib.widget.LottieColorUtils;
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView;
|
import com.airbnb.lottie.LottieAnimationView;
|
||||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
@@ -55,6 +56,9 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
@Nullable
|
@Nullable
|
||||||
private FingerprintFindSensorAnimation mAnimation;
|
private FingerprintFindSensorAnimation mAnimation;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private LottieAnimationView mIllustrationLottie;
|
||||||
|
|
||||||
private FingerprintEnrollSidecar mSidecar;
|
private FingerprintEnrollSidecar mSidecar;
|
||||||
private boolean mNextClicked;
|
private boolean mNextClicked;
|
||||||
private boolean mCanAssumeUdfps;
|
private boolean mCanAssumeUdfps;
|
||||||
@@ -97,38 +101,14 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
|
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||||
AccessibilityManager am = getSystemService(AccessibilityManager.class);
|
AccessibilityManager am = getSystemService(AccessibilityManager.class);
|
||||||
if (am.isEnabled()) {
|
if (am.isEnabled()) {
|
||||||
lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
|
mIllustrationLottie.setAnimation(R.raw.udfps_edu_a11y_lottie);
|
||||||
}
|
}
|
||||||
} else if (mCanAssumeSfps) {
|
} else if (mCanAssumeSfps) {
|
||||||
setHeaderText(R.string.security_settings_sfps_enroll_find_sensor_title);
|
setHeaderText(R.string.security_settings_sfps_enroll_find_sensor_title);
|
||||||
setDescriptionText(R.string.security_settings_sfps_enroll_find_sensor_message);
|
setDescriptionText(R.string.security_settings_sfps_enroll_find_sensor_message);
|
||||||
final LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
|
|
||||||
final LottieAnimationView lottieAnimationViewPortrait =
|
|
||||||
findViewById(R.id.illustration_lottie_portrait);
|
|
||||||
final int rotation = getApplicationContext().getDisplay().getRotation();
|
|
||||||
switch(rotation) {
|
|
||||||
case Surface.ROTATION_90:
|
|
||||||
lottieAnimationView.setVisibility(View.GONE);
|
|
||||||
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
|
||||||
case Surface.ROTATION_180:
|
|
||||||
lottieAnimationView.setVisibility(View.VISIBLE);
|
|
||||||
lottieAnimationView.setRotation(180);
|
|
||||||
lottieAnimationViewPortrait.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
case Surface.ROTATION_270:
|
|
||||||
lottieAnimationView.setVisibility(View.GONE);
|
|
||||||
lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
|
|
||||||
lottieAnimationViewPortrait.setRotation(180);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
lottieAnimationView.setVisibility(View.VISIBLE);
|
|
||||||
lottieAnimationViewPortrait.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
||||||
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
||||||
@@ -170,14 +150,13 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
|
|
||||||
mAnimation = null;
|
mAnimation = null;
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
|
mIllustrationLottie.setOnClickListener(new OnClickListener() {
|
||||||
lottieAnimationView.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
onStartButtonClick(v);
|
onStartButtonClick(v);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else if (!mCanAssumeSfps) {
|
||||||
View animationView = findViewById(R.id.fingerprint_sensor_location_animation);
|
View animationView = findViewById(R.id.fingerprint_sensor_location_animation);
|
||||||
if (animationView instanceof FingerprintFindSensorAnimation) {
|
if (animationView instanceof FingerprintFindSensorAnimation) {
|
||||||
mAnimation = (FingerprintFindSensorAnimation) animationView;
|
mAnimation = (FingerprintFindSensorAnimation) animationView;
|
||||||
@@ -185,6 +164,41 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSfpsFindSensorAnimationAsset() {
|
||||||
|
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||||
|
LottieColorUtils.applyDynamicColors(getApplicationContext(), mIllustrationLottie);
|
||||||
|
mIllustrationLottie.setVisibility(View.VISIBLE);
|
||||||
|
final int rotation = getApplicationContext().getDisplay().getRotation();
|
||||||
|
|
||||||
|
switch (rotation) {
|
||||||
|
case Surface.ROTATION_90:
|
||||||
|
mIllustrationLottie.setAnimation(
|
||||||
|
R.raw.fingerprint_edu_lottie_portrait_top_left);
|
||||||
|
break;
|
||||||
|
case Surface.ROTATION_180:
|
||||||
|
mIllustrationLottie.setAnimation(
|
||||||
|
R.raw.fingerprint_edu_lottie_landscape_bottom_left);
|
||||||
|
break;
|
||||||
|
case Surface.ROTATION_270:
|
||||||
|
mIllustrationLottie.setAnimation(
|
||||||
|
R.raw.fingerprint_edu_lottie_portrait_bottom_right);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mIllustrationLottie.setAnimation(
|
||||||
|
R.raw.fingerprint_edu_lottie_landscape_top_right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mIllustrationLottie.playAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (mCanAssumeSfps) {
|
||||||
|
updateSfpsFindSensorAnimationAsset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.dumpstate.V1_0.IDumpstateDevice;
|
import android.hardware.dumpstate.V1_0.IDumpstateDevice;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.ServiceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -40,8 +41,12 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
|
|
||||||
private static final String ENABLE_VERBOSE_VENDOR_LOGGING_KEY = "enable_verbose_vendor_logging";
|
private static final String ENABLE_VERBOSE_VENDOR_LOGGING_KEY = "enable_verbose_vendor_logging";
|
||||||
private static final int DUMPSTATE_HAL_VERSION_UNKNOWN = -1;
|
private static final int DUMPSTATE_HAL_VERSION_UNKNOWN = -1;
|
||||||
private static final int DUMPSTATE_HAL_VERSION_1_0 = 0;
|
private static final int DUMPSTATE_HAL_VERSION_1_0 = 0; // HIDL v1.0
|
||||||
private static final int DUMPSTATE_HAL_VERSION_1_1 = 1;
|
private static final int DUMPSTATE_HAL_VERSION_1_1 = 1; // HIDL v1.1
|
||||||
|
private static final int DUMPSTATE_HAL_VERSION_2_0 = 2; // AIDL v1
|
||||||
|
|
||||||
|
private static final String DUMP_STATE_AIDL_SERVICE_NAME =
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice.DESCRIPTOR + "/default";
|
||||||
|
|
||||||
private int mDumpstateHalVersion;
|
private int mDumpstateHalVersion;
|
||||||
|
|
||||||
@@ -57,9 +62,8 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
// Only show preference when IDumpstateDevice v1.1 is avalaible
|
// Only show preference when IDumpstateDevice AIDL or HIDL v1.1 service is available
|
||||||
// This is temperary strategy that may change later.
|
return isIDumpstateDeviceAidlServiceAvailable() || isIDumpstateDeviceV1_1ServiceAvailable();
|
||||||
return isIDumpstateDeviceV1_1ServiceAvailable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,15 +90,31 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
boolean isIDumpstateDeviceV1_1ServiceAvailable() {
|
boolean isIDumpstateDeviceV1_1ServiceAvailable() {
|
||||||
IDumpstateDevice service = getDumpstateDeviceService();
|
IDumpstateDevice service = getDumpstateDeviceService();
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
if (DBG) Log.d(TAG, "IDumpstateDevice service is not available.");
|
if (DBG) Log.d(TAG, "IDumpstateDevice v1.1 service is not available.");
|
||||||
}
|
}
|
||||||
return service != null && mDumpstateHalVersion >= DUMPSTATE_HAL_VERSION_1_1;
|
return service != null && mDumpstateHalVersion == DUMPSTATE_HAL_VERSION_1_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean isIDumpstateDeviceAidlServiceAvailable() {
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice aidlService = getDumpstateDeviceAidlService();
|
||||||
|
return aidlService != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void setVerboseLoggingEnabled(boolean enable) {
|
void setVerboseLoggingEnabled(boolean enable) {
|
||||||
IDumpstateDevice service = getDumpstateDeviceService();
|
// First check if AIDL service is available
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice aidlService = getDumpstateDeviceAidlService();
|
||||||
|
if (aidlService != null) {
|
||||||
|
try {
|
||||||
|
aidlService.setVerboseLoggingEnabled(enable);
|
||||||
|
} catch (RemoteException re) {
|
||||||
|
if (DBG) Log.e(TAG, "aidlService.setVerboseLoggingEnabled fail: " + re);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then check HIDL v1.1 service
|
||||||
|
IDumpstateDevice service = getDumpstateDeviceService();
|
||||||
if (service == null || mDumpstateHalVersion < DUMPSTATE_HAL_VERSION_1_1) {
|
if (service == null || mDumpstateHalVersion < DUMPSTATE_HAL_VERSION_1_1) {
|
||||||
if (DBG) Log.d(TAG, "setVerboseLoggingEnabled not supported.");
|
if (DBG) Log.d(TAG, "setVerboseLoggingEnabled not supported.");
|
||||||
return;
|
return;
|
||||||
@@ -107,14 +127,24 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
service11.setVerboseLoggingEnabled(enable);
|
service11.setVerboseLoggingEnabled(enable);
|
||||||
}
|
}
|
||||||
} catch (RemoteException | RuntimeException e) {
|
} catch (RemoteException | RuntimeException e) {
|
||||||
if (DBG) Log.e(TAG, "setVerboseLoggingEnabled fail: " + e);
|
if (DBG) Log.e(TAG, "HIDL v1.1 setVerboseLoggingEnabled fail: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean getVerboseLoggingEnabled() {
|
boolean getVerboseLoggingEnabled() {
|
||||||
IDumpstateDevice service = getDumpstateDeviceService();
|
// First check if AIDL service is available
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice aidlService = getDumpstateDeviceAidlService();
|
||||||
|
if (aidlService != null) {
|
||||||
|
try {
|
||||||
|
return aidlService.getVerboseLoggingEnabled();
|
||||||
|
} catch (RemoteException re) {
|
||||||
|
if (DBG) Log.e(TAG, "aidlService.getVerboseLoggingEnabled fail: " + re);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then check HIDL v1.1 service
|
||||||
|
IDumpstateDevice service = getDumpstateDeviceService();
|
||||||
if (service == null || mDumpstateHalVersion < DUMPSTATE_HAL_VERSION_1_1) {
|
if (service == null || mDumpstateHalVersion < DUMPSTATE_HAL_VERSION_1_1) {
|
||||||
if (DBG) Log.d(TAG, "getVerboseLoggingEnabled not supported.");
|
if (DBG) Log.d(TAG, "getVerboseLoggingEnabled not supported.");
|
||||||
return false;
|
return false;
|
||||||
@@ -127,7 +157,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
return service11.getVerboseLoggingEnabled();
|
return service11.getVerboseLoggingEnabled();
|
||||||
}
|
}
|
||||||
} catch (RemoteException | RuntimeException e) {
|
} catch (RemoteException | RuntimeException e) {
|
||||||
if (DBG) Log.e(TAG, "getVerboseLoggingEnabled fail: " + e);
|
if (DBG) Log.e(TAG, "HIDL v1.1 getVerboseLoggingEnabled fail: " + e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -141,6 +171,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
.getService(true /* retry */);
|
.getService(true /* retry */);
|
||||||
mDumpstateHalVersion = DUMPSTATE_HAL_VERSION_1_1;
|
mDumpstateHalVersion = DUMPSTATE_HAL_VERSION_1_1;
|
||||||
} catch (NoSuchElementException | RemoteException e) {
|
} catch (NoSuchElementException | RemoteException e) {
|
||||||
|
if (DBG) Log.e(TAG, "Get HIDL v1.1 service fail: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
@@ -149,6 +180,7 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
.getService(true /* retry */);
|
.getService(true /* retry */);
|
||||||
mDumpstateHalVersion = DUMPSTATE_HAL_VERSION_1_0;
|
mDumpstateHalVersion = DUMPSTATE_HAL_VERSION_1_0;
|
||||||
} catch (NoSuchElementException | RemoteException e) {
|
} catch (NoSuchElementException | RemoteException e) {
|
||||||
|
if (DBG) Log.e(TAG, "Get HIDL v1.0 service fail: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,4 +189,24 @@ public class EnableVerboseVendorLoggingPreferenceController
|
|||||||
}
|
}
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a {@link android.hardware.dumpstate.IDumpstateDevice} instance or null if service is
|
||||||
|
* not available.
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
@Nullable android.hardware.dumpstate.IDumpstateDevice getDumpstateDeviceAidlService() {
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice service = null;
|
||||||
|
try {
|
||||||
|
service = android.hardware.dumpstate.IDumpstateDevice.Stub.asInterface(
|
||||||
|
ServiceManager.waitForDeclaredService(DUMP_STATE_AIDL_SERVICE_NAME));
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
if (DBG) Log.e(TAG, "Get AIDL service fail: " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (service != null) {
|
||||||
|
mDumpstateHalVersion = DUMPSTATE_HAL_VERSION_2_0;
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,8 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
private PreferenceScreen mPreferenceScreen;
|
private PreferenceScreen mPreferenceScreen;
|
||||||
@Mock
|
@Mock
|
||||||
IDumpstateDevice mIDumpstateDevice;
|
IDumpstateDevice mIDumpstateDevice;
|
||||||
|
@Mock
|
||||||
|
android.hardware.dumpstate.IDumpstateDevice mIDumpstateDeviceAidl;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private EnableVerboseVendorLoggingPreferenceController mController;
|
private EnableVerboseVendorLoggingPreferenceController mController;
|
||||||
@@ -57,6 +59,7 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mController = spy(new EnableVerboseVendorLoggingPreferenceController(mContext));
|
mController = spy(new EnableVerboseVendorLoggingPreferenceController(mContext));
|
||||||
doReturn(mIDumpstateDevice).when(mController).getDumpstateDeviceService();
|
doReturn(mIDumpstateDevice).when(mController).getDumpstateDeviceService();
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
|
||||||
// mock with Dumpstate HAL v1.1
|
// mock with Dumpstate HAL v1.1
|
||||||
Field f = EnableVerboseVendorLoggingPreferenceController.class
|
Field f = EnableVerboseVendorLoggingPreferenceController.class
|
||||||
@@ -70,7 +73,9 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_settingEnable_enableVendorLoggingShouldBeOn() throws Exception {
|
public void onPreferenceChange_settingEnableByHidl_enableVendorLoggingShouldBeOn()
|
||||||
|
throws Exception {
|
||||||
|
doReturn(null).when(mController).getDumpstateDeviceAidlService();
|
||||||
doReturn(true).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
doReturn(true).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||||
@@ -80,8 +85,21 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_settingDisable_enableVendorLoggingShouldBeOff()
|
public void onPreferenceChange_settingEnableByAidl_enableVendorLoggingShouldBeOn()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
doReturn(true).when(mIDumpstateDeviceAidl).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
|
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||||
|
|
||||||
|
final boolean enabled = mController.getVerboseLoggingEnabled();
|
||||||
|
assertTrue(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onPreferenceChange_settingDisableByHidl_enableVendorLoggingShouldBeOff()
|
||||||
|
throws Exception {
|
||||||
|
doReturn(null).when(mController).getDumpstateDeviceAidlService();
|
||||||
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
mController.onPreferenceChange(mPreference, false /* new value */);
|
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||||
@@ -91,7 +109,20 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_settingDisabled_preferenceShouldNotBeChecked() throws Exception {
|
public void onPreferenceChange_settingDisableByAidl_enableVendorLoggingShouldBeOff()
|
||||||
|
throws Exception {
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
doReturn(false).when(mIDumpstateDeviceAidl).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
|
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||||
|
|
||||||
|
final boolean enabled = mController.getVerboseLoggingEnabled();
|
||||||
|
assertFalse(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_settingDisabledByHidl_preferenceShouldNotBeChecked() throws Exception {
|
||||||
|
doReturn(null).when(mController).getDumpstateDeviceAidlService();
|
||||||
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
mController.setVerboseLoggingEnabled(false);
|
mController.setVerboseLoggingEnabled(false);
|
||||||
@@ -101,7 +132,19 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_settingEnabled_preferenceShouldBeChecked() throws Exception {
|
public void updateState_settingDisabledByAidl_preferenceShouldNotBeChecked() throws Exception {
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
doReturn(false).when(mIDumpstateDeviceAidl).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
|
mController.setVerboseLoggingEnabled(false);
|
||||||
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
verify(mPreference).setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_settingEnabledByHidl_preferenceShouldBeChecked() throws Exception {
|
||||||
|
doReturn(null).when(mController).getDumpstateDeviceAidlService();
|
||||||
doReturn(true).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
doReturn(true).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
mController.setVerboseLoggingEnabled(true);
|
mController.setVerboseLoggingEnabled(true);
|
||||||
@@ -111,7 +154,19 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onDeveloperOptionDisabled_shouldDisablePreference() throws Exception {
|
public void updateState_settingEnabledByAidl_preferenceShouldBeChecked() throws Exception {
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
doReturn(true).when(mIDumpstateDeviceAidl).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
|
mController.setVerboseLoggingEnabled(true);
|
||||||
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
verify(mPreference).setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onDeveloperOptionDisabled_byHidl_shouldDisablePreference() throws Exception {
|
||||||
|
doReturn(null).when(mController).getDumpstateDeviceAidlService();
|
||||||
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
doReturn(false).when(mIDumpstateDevice).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
mController.onDeveloperOptionsSwitchDisabled();
|
mController.onDeveloperOptionsSwitchDisabled();
|
||||||
@@ -121,4 +176,17 @@ public final class EnableVerboseVendorLoggingPreferenceControllerTest {
|
|||||||
verify(mPreference).setChecked(false);
|
verify(mPreference).setChecked(false);
|
||||||
verify(mPreference).setEnabled(false);
|
verify(mPreference).setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onDeveloperOptionDisabled_byAidl_shouldDisablePreference() throws Exception {
|
||||||
|
doReturn(mIDumpstateDeviceAidl).when(mController).getDumpstateDeviceAidlService();
|
||||||
|
doReturn(false).when(mIDumpstateDeviceAidl).getVerboseLoggingEnabled();
|
||||||
|
|
||||||
|
mController.onDeveloperOptionsSwitchDisabled();
|
||||||
|
|
||||||
|
final boolean enabled = mController.getVerboseLoggingEnabled();
|
||||||
|
assertFalse(enabled);
|
||||||
|
verify(mPreference).setChecked(false);
|
||||||
|
verify(mPreference).setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user