Merge "Use migrated severity levels" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a493ed6f75
@@ -25,7 +25,6 @@ import android.os.Bundle;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.safetycenter.SafetyEvent;
|
import android.safetycenter.SafetyEvent;
|
||||||
import android.safetycenter.SafetySourceData;
|
import android.safetycenter.SafetySourceData;
|
||||||
import android.safetycenter.SafetySourceSeverity;
|
|
||||||
import android.safetycenter.SafetySourceStatus;
|
import android.safetycenter.SafetySourceStatus;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -122,8 +121,8 @@ public final class BiometricsSafetySource {
|
|||||||
Intent clickIntent, boolean enabled, boolean hasEnrolled, SafetyEvent safetyEvent) {
|
Intent clickIntent, boolean enabled, boolean hasEnrolled, SafetyEvent safetyEvent) {
|
||||||
final PendingIntent pendingIntent = createPendingIntent(context, clickIntent);
|
final PendingIntent pendingIntent = createPendingIntent(context, clickIntent);
|
||||||
final int severityLevel =
|
final int severityLevel =
|
||||||
enabled && hasEnrolled ? SafetySourceSeverity.LEVEL_INFORMATION
|
enabled && hasEnrolled ? SafetySourceData.SEVERITY_LEVEL_INFORMATION
|
||||||
: SafetySourceSeverity.LEVEL_UNSPECIFIED;
|
: SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED;
|
||||||
|
|
||||||
final SafetySourceStatus status = new SafetySourceStatus.Builder(title, summary,
|
final SafetySourceStatus status = new SafetySourceStatus.Builder(title, summary,
|
||||||
severityLevel).setPendingIntent(pendingIntent).setEnabled(enabled).build();
|
severityLevel).setPendingIntent(pendingIntent).setEnabled(enabled).build();
|
||||||
|
@@ -26,7 +26,6 @@ import android.os.UserHandle;
|
|||||||
import android.safetycenter.SafetyEvent;
|
import android.safetycenter.SafetyEvent;
|
||||||
import android.safetycenter.SafetySourceData;
|
import android.safetycenter.SafetySourceData;
|
||||||
import android.safetycenter.SafetySourceIssue;
|
import android.safetycenter.SafetySourceIssue;
|
||||||
import android.safetycenter.SafetySourceSeverity;
|
|
||||||
import android.safetycenter.SafetySourceStatus;
|
import android.safetycenter.SafetySourceStatus;
|
||||||
import android.safetycenter.SafetySourceStatus.IconAction;
|
import android.safetycenter.SafetySourceStatus.IconAction;
|
||||||
|
|
||||||
@@ -71,9 +70,9 @@ public final class LockScreenSafetySource {
|
|||||||
final boolean isLockPatternSecure = screenLockPreferenceDetailsUtils.isLockPatternSecure();
|
final boolean isLockPatternSecure = screenLockPreferenceDetailsUtils.isLockPatternSecure();
|
||||||
final int severityLevel = enabled
|
final int severityLevel = enabled
|
||||||
? isLockPatternSecure
|
? isLockPatternSecure
|
||||||
? SafetySourceSeverity.LEVEL_INFORMATION
|
? SafetySourceData.SEVERITY_LEVEL_INFORMATION
|
||||||
: SafetySourceSeverity.LEVEL_RECOMMENDATION
|
: SafetySourceData.SEVERITY_LEVEL_RECOMMENDATION
|
||||||
: SafetySourceSeverity.LEVEL_UNSPECIFIED;
|
: SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED;
|
||||||
|
|
||||||
|
|
||||||
final SafetySourceStatus status = new SafetySourceStatus.Builder(
|
final SafetySourceStatus status = new SafetySourceStatus.Builder(
|
||||||
@@ -138,7 +137,7 @@ public final class LockScreenSafetySource {
|
|||||||
NO_SCREEN_LOCK_ISSUE_ID,
|
NO_SCREEN_LOCK_ISSUE_ID,
|
||||||
context.getString(R.string.no_screen_lock_issue_title),
|
context.getString(R.string.no_screen_lock_issue_title),
|
||||||
context.getString(R.string.no_screen_lock_issue_summary),
|
context.getString(R.string.no_screen_lock_issue_summary),
|
||||||
SafetySourceSeverity.LEVEL_RECOMMENDATION,
|
SafetySourceData.SEVERITY_LEVEL_RECOMMENDATION,
|
||||||
NO_SCREEN_LOCK_ISSUE_TYPE_ID)
|
NO_SCREEN_LOCK_ISSUE_TYPE_ID)
|
||||||
.setIssueCategory(SafetySourceIssue.ISSUE_CATEGORY_DEVICE)
|
.setIssueCategory(SafetySourceIssue.ISSUE_CATEGORY_DEVICE)
|
||||||
.addAction(action).build();
|
.addAction(action).build();
|
||||||
|
@@ -40,7 +40,6 @@ import android.hardware.fingerprint.FingerprintManager;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.safetycenter.SafetyEvent;
|
import android.safetycenter.SafetyEvent;
|
||||||
import android.safetycenter.SafetySourceData;
|
import android.safetycenter.SafetySourceData;
|
||||||
import android.safetycenter.SafetySourceSeverity;
|
|
||||||
import android.safetycenter.SafetySourceStatus;
|
import android.safetycenter.SafetySourceStatus;
|
||||||
|
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
@@ -442,7 +441,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_INFORMATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -460,7 +459,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_INFORMATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -478,7 +477,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -495,7 +494,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_INFORMATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -512,7 +511,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -529,7 +528,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_INFORMATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -546,7 +545,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
|
||||||
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
SafetySourceStatus safetySourceStatus = captor.getValue().getStatus();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertSafetySourceDisabledDataSetWithSingularSummary(String expectedTitleResName,
|
private void assertSafetySourceDisabledDataSetWithSingularSummary(String expectedTitleResName,
|
||||||
@@ -606,7 +605,7 @@ public class BiometricsSafetySourceTest {
|
|||||||
assertThat(safetySourceStatus.getSummary().toString()).isEqualTo(expectedSummary);
|
assertThat(safetySourceStatus.getSummary().toString()).isEqualTo(expectedSummary);
|
||||||
assertThat(safetySourceStatus.isEnabled()).isFalse();
|
assertThat(safetySourceStatus.isEnabled()).isFalse();
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
|
|
||||||
final Intent clickIntent = safetySourceStatus.getPendingIntent().getIntent();
|
final Intent clickIntent = safetySourceStatus.getPendingIntent().getIntent();
|
||||||
assertThat(clickIntent).isNotNull();
|
assertThat(clickIntent).isNotNull();
|
||||||
|
@@ -32,7 +32,6 @@ import android.content.Intent;
|
|||||||
import android.safetycenter.SafetyEvent;
|
import android.safetycenter.SafetyEvent;
|
||||||
import android.safetycenter.SafetySourceData;
|
import android.safetycenter.SafetySourceData;
|
||||||
import android.safetycenter.SafetySourceIssue;
|
import android.safetycenter.SafetySourceIssue;
|
||||||
import android.safetycenter.SafetySourceSeverity;
|
|
||||||
import android.safetycenter.SafetySourceStatus;
|
import android.safetycenter.SafetySourceStatus;
|
||||||
import android.safetycenter.SafetySourceStatus.IconAction;
|
import android.safetycenter.SafetySourceStatus.IconAction;
|
||||||
|
|
||||||
@@ -179,7 +178,7 @@ public class LockScreenSafetySourceTest {
|
|||||||
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
||||||
|
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_INFORMATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -200,7 +199,7 @@ public class LockScreenSafetySourceTest {
|
|||||||
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
||||||
|
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_RECOMMENDATION);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_RECOMMENDATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -221,7 +220,7 @@ public class LockScreenSafetySourceTest {
|
|||||||
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
||||||
|
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -242,7 +241,7 @@ public class LockScreenSafetySourceTest {
|
|||||||
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
|
||||||
|
|
||||||
assertThat(safetySourceStatus.getSeverityLevel())
|
assertThat(safetySourceStatus.getSeverityLevel())
|
||||||
.isEqualTo(SafetySourceSeverity.LEVEL_UNSPECIFIED);
|
.isEqualTo(SafetySourceData.SEVERITY_LEVEL_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -289,7 +288,8 @@ public class LockScreenSafetySourceTest {
|
|||||||
assertThat(issue.getSummary().toString()).isEqualTo(
|
assertThat(issue.getSummary().toString()).isEqualTo(
|
||||||
ResourcesUtils.getResourcesString(mApplicationContext,
|
ResourcesUtils.getResourcesString(mApplicationContext,
|
||||||
"no_screen_lock_issue_summary"));
|
"no_screen_lock_issue_summary"));
|
||||||
assertThat(issue.getSeverityLevel()).isEqualTo(SafetySourceSeverity.LEVEL_RECOMMENDATION);
|
assertThat(issue.getSeverityLevel()).isEqualTo(
|
||||||
|
SafetySourceData.SEVERITY_LEVEL_RECOMMENDATION);
|
||||||
assertThat(issue.getIssueTypeId()).isEqualTo(
|
assertThat(issue.getIssueTypeId()).isEqualTo(
|
||||||
LockScreenSafetySource.NO_SCREEN_LOCK_ISSUE_TYPE_ID);
|
LockScreenSafetySource.NO_SCREEN_LOCK_ISSUE_TYPE_ID);
|
||||||
assertThat(issue.getIssueCategory()).isEqualTo(SafetySourceIssue.ISSUE_CATEGORY_DEVICE);
|
assertThat(issue.getIssueCategory()).isEqualTo(SafetySourceIssue.ISSUE_CATEGORY_DEVICE);
|
||||||
|
Reference in New Issue
Block a user