From 87dbf9c4b8e89234604a51d0cdabec8b027a04a2 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Thu, 29 Aug 2024 13:17:36 +0800 Subject: [PATCH 01/23] [Safer intents] App Time Spent Preference Set package com.android.internal.R.string.config_systemWellbeing to the intent. Fix: 356117796 Flag: EXEMPT bug fix Test: manual - on App info Test: atest AppTimeSpentPreferenceTest Change-Id: I2af7b53a75fe5c6915dd9781406039822789c18c Merged-In: I2af7b53a75fe5c6915dd9781406039822789c18c --- .../spa/app/appinfo/AppTimeSpentPreference.kt | 67 ++++++++++++------- .../app/appinfo/AppTimeSpentPreferenceTest.kt | 67 +++++++------------ 2 files changed, 66 insertions(+), 68 deletions(-) diff --git a/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt b/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt index 1ef893603c0..1b605a81611 100644 --- a/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt +++ b/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt @@ -19,14 +19,16 @@ package com.android.settings.spa.app.appinfo import android.content.Context import android.content.Intent import android.content.pm.ApplicationInfo -import android.content.pm.PackageManager.ResolveInfoFlags +import android.content.pm.PackageManager +import android.content.pm.ResolveInfo import android.provider.Settings import androidx.compose.runtime.Composable -import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource -import androidx.lifecycle.liveData +import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.settings.R import com.android.settings.overlay.FeatureFactory import com.android.settingslib.spa.framework.compose.stateOf @@ -36,44 +38,61 @@ import com.android.settingslib.spaprivileged.model.app.hasFlag import com.android.settingslib.spaprivileged.model.app.userHandle import com.android.settingslib.spaprivileged.model.app.userId import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOn +@OptIn(ExperimentalLifecycleComposeApi::class) @Composable fun AppTimeSpentPreference(app: ApplicationInfo) { val context = LocalContext.current - val presenter = remember { AppTimeSpentPresenter(context, app) } - if (!presenter.isAvailable()) return + val presenter = remember(app) { AppTimeSpentPresenter(context, app) } + val isAvailable by presenter.isAvailableFlow.collectAsStateWithLifecycle(initialValue = false) + if (!isAvailable) return - Preference(object : PreferenceModel { - override val title = stringResource(R.string.time_spent_in_app_pref_title) - override val summary = presenter.summaryLiveData.observeAsState( - initial = stringResource(R.string.summary_placeholder), - ) - override val enabled = stateOf(presenter.isEnabled()) - override val onClick = presenter::startActivity - }) + val summary = presenter.summaryFlow.collectAsStateWithLifecycle( + initialValue = stringResource(R.string.summary_placeholder), + ) + Preference( + object : PreferenceModel { + override val title = stringResource(R.string.time_spent_in_app_pref_title) + override val summary = summary + override val enabled = stateOf(presenter.isEnabled()) + override val onClick = presenter::startActivity + } + ) } private class AppTimeSpentPresenter( private val context: Context, private val app: ApplicationInfo, ) { - private val intent = Intent(Settings.ACTION_APP_USAGE_SETTINGS).apply { - putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName) - } + private val intent = + Intent(Settings.ACTION_APP_USAGE_SETTINGS).apply { + // Limit the package for safer intents, since string resource is not null, + // we restrict the target to this single package. + setPackage(context.getString(com.android.internal.R.string.config_systemWellbeing)) + putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName) + } + private val appFeatureProvider = FeatureFactory.getFactory(context) .getApplicationFeatureProvider(context) - fun isAvailable() = context.packageManager.queryIntentActivitiesAsUser( - intent, ResolveInfoFlags.of(0), app.userId - ).any { resolveInfo -> - resolveInfo?.activityInfo?.applicationInfo?.isSystemApp == true - } + val isAvailableFlow = flow { emit(resolveIntent() != null) }.flowOn(Dispatchers.Default) + + // Resolve the intent first with PackageManager.MATCH_SYSTEM_ONLY flag to ensure that + // only system apps are resolved. + private fun resolveIntent(): ResolveInfo? = + context.packageManager.resolveActivityAsUser( + intent, + PackageManager.MATCH_SYSTEM_ONLY, + app.userId, + ) fun isEnabled() = app.hasFlag(ApplicationInfo.FLAG_INSTALLED) - val summaryLiveData = liveData(Dispatchers.IO) { - emit(appFeatureProvider.getTimeSpentInApp(app.packageName).toString()) - } + val summaryFlow = + flow { emit(appFeatureProvider.getTimeSpentInApp(app.packageName).toString()) } + .flowOn(Dispatchers.Default) fun startActivity() { context.startActivityAsUser(intent, app.userHandle) diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt index 6cc3e3c57e7..32b7e779ce2 100644 --- a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt +++ b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt @@ -17,17 +17,16 @@ package com.android.settings.spa.app.appinfo import android.content.Context -import android.content.pm.ActivityInfo import android.content.pm.ApplicationInfo import android.content.pm.PackageManager -import android.content.pm.PackageManager.ResolveInfoFlags import android.content.pm.ResolveInfo import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.test.assertIsDisplayed -import androidx.compose.ui.test.assertIsEnabled import androidx.compose.ui.test.assertIsNotDisplayed import androidx.compose.ui.test.assertIsNotEnabled +import androidx.compose.ui.test.hasText +import androidx.compose.ui.test.isEnabled import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onRoot @@ -35,12 +34,13 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.settings.R import com.android.settings.testutils.FakeFeatureFactory +import com.android.settingslib.spa.testutils.any +import com.android.settingslib.spa.testutils.waitUntilExists import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -import org.mockito.Mockito.any import org.mockito.Mockito.anyInt import org.mockito.Spy import org.mockito.junit.MockitoJUnit @@ -59,39 +59,26 @@ class AppTimeSpentPreferenceTest { private val context: Context = ApplicationProvider.getApplicationContext() @Mock - private lateinit var packageManager: PackageManager + private lateinit var mockPackageManager: PackageManager private val fakeFeatureFactory = FakeFeatureFactory() private val appFeatureProvider = fakeFeatureFactory.mockApplicationFeatureProvider @Before fun setUp() { - whenever(context.packageManager).thenReturn(packageManager) + whenever(context.packageManager).thenReturn(mockPackageManager) whenever(appFeatureProvider.getTimeSpentInApp(PACKAGE_NAME)).thenReturn(TIME_SPENT) } - private fun mockActivitiesQueryResult(resolveInfos: List) { + private fun mockActivityQueryResult(resolveInfo: ResolveInfo?) { whenever( - packageManager.queryIntentActivitiesAsUser(any(), any(), anyInt()) - ).thenReturn(resolveInfos) + mockPackageManager.resolveActivityAsUser(any(), anyInt(), anyInt()) + ).thenReturn(resolveInfo) } @Test fun noIntentHandler_notDisplay() { - mockActivitiesQueryResult(emptyList()) - - composeTestRule.setContent { - CompositionLocalProvider(LocalContext provides context) { - AppTimeSpentPreference(INSTALLED_APP) - } - } - - composeTestRule.onRoot().assertIsNotDisplayed() - } - - @Test - fun hasIntentHandler_notSystemApp_notDisplay() { - mockActivitiesQueryResult(listOf(ResolveInfo())) + mockActivityQueryResult(null) composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -104,7 +91,7 @@ class AppTimeSpentPreferenceTest { @Test fun installedApp_enabled() { - mockActivitiesQueryResult(listOf(MATCHED_RESOLVE_INFO)) + mockActivityQueryResult(ResolveInfo()) composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -112,18 +99,16 @@ class AppTimeSpentPreferenceTest { } } - composeTestRule.onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) - .assertIsDisplayed() - .assertIsEnabled() + composeTestRule.waitUntilExists( + hasText(context.getString(R.string.time_spent_in_app_pref_title)) and isEnabled() + ) composeTestRule.onNodeWithText(TIME_SPENT).assertIsDisplayed() } @Test fun notInstalledApp_disabled() { - mockActivitiesQueryResult(listOf(MATCHED_RESOLVE_INFO)) - val notInstalledApp = ApplicationInfo().apply { - packageName = PACKAGE_NAME - } + mockActivityQueryResult(ResolveInfo()) + val notInstalledApp = ApplicationInfo().apply { packageName = PACKAGE_NAME } composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -131,25 +116,19 @@ class AppTimeSpentPreferenceTest { } } - composeTestRule.onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) + composeTestRule + .onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) .assertIsNotEnabled() } companion object { - private const val PACKAGE_NAME = "package name" + private const val PACKAGE_NAME = "package.name" private const val TIME_SPENT = "15 minutes" - private val INSTALLED_APP = ApplicationInfo().apply { - packageName = PACKAGE_NAME - flags = ApplicationInfo.FLAG_INSTALLED - } - - private val MATCHED_RESOLVE_INFO = ResolveInfo().apply { - activityInfo = ActivityInfo().apply { - applicationInfo = ApplicationInfo().apply { - flags = ApplicationInfo.FLAG_SYSTEM - } + private val INSTALLED_APP = + ApplicationInfo().apply { + packageName = PACKAGE_NAME + flags = ApplicationInfo.FLAG_INSTALLED } - } } } From e401ea474357b9980066e7447bff6699298f3a20 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Thu, 29 Aug 2024 13:17:36 +0800 Subject: [PATCH 02/23] [Safer intents] App Time Spent Preference Set package com.android.internal.R.string.config_systemWellbeing to the intent. Fix: 356117796 Flag: EXEMPT bug fix Test: manual - on App info Test: atest AppTimeSpentPreferenceTest Change-Id: I2af7b53a75fe5c6915dd9781406039822789c18c Merged-In: I2af7b53a75fe5c6915dd9781406039822789c18c --- .../spa/app/appinfo/AppTimeSpentPreference.kt | 67 ++++++++++++------- .../app/appinfo/AppTimeSpentPreferenceTest.kt | 67 +++++++------------ 2 files changed, 66 insertions(+), 68 deletions(-) diff --git a/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt b/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt index 1ef893603c0..1b605a81611 100644 --- a/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt +++ b/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreference.kt @@ -19,14 +19,16 @@ package com.android.settings.spa.app.appinfo import android.content.Context import android.content.Intent import android.content.pm.ApplicationInfo -import android.content.pm.PackageManager.ResolveInfoFlags +import android.content.pm.PackageManager +import android.content.pm.ResolveInfo import android.provider.Settings import androidx.compose.runtime.Composable -import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource -import androidx.lifecycle.liveData +import androidx.lifecycle.compose.ExperimentalLifecycleComposeApi +import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.settings.R import com.android.settings.overlay.FeatureFactory import com.android.settingslib.spa.framework.compose.stateOf @@ -36,44 +38,61 @@ import com.android.settingslib.spaprivileged.model.app.hasFlag import com.android.settingslib.spaprivileged.model.app.userHandle import com.android.settingslib.spaprivileged.model.app.userId import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.flowOn +@OptIn(ExperimentalLifecycleComposeApi::class) @Composable fun AppTimeSpentPreference(app: ApplicationInfo) { val context = LocalContext.current - val presenter = remember { AppTimeSpentPresenter(context, app) } - if (!presenter.isAvailable()) return + val presenter = remember(app) { AppTimeSpentPresenter(context, app) } + val isAvailable by presenter.isAvailableFlow.collectAsStateWithLifecycle(initialValue = false) + if (!isAvailable) return - Preference(object : PreferenceModel { - override val title = stringResource(R.string.time_spent_in_app_pref_title) - override val summary = presenter.summaryLiveData.observeAsState( - initial = stringResource(R.string.summary_placeholder), - ) - override val enabled = stateOf(presenter.isEnabled()) - override val onClick = presenter::startActivity - }) + val summary = presenter.summaryFlow.collectAsStateWithLifecycle( + initialValue = stringResource(R.string.summary_placeholder), + ) + Preference( + object : PreferenceModel { + override val title = stringResource(R.string.time_spent_in_app_pref_title) + override val summary = summary + override val enabled = stateOf(presenter.isEnabled()) + override val onClick = presenter::startActivity + } + ) } private class AppTimeSpentPresenter( private val context: Context, private val app: ApplicationInfo, ) { - private val intent = Intent(Settings.ACTION_APP_USAGE_SETTINGS).apply { - putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName) - } + private val intent = + Intent(Settings.ACTION_APP_USAGE_SETTINGS).apply { + // Limit the package for safer intents, since string resource is not null, + // we restrict the target to this single package. + setPackage(context.getString(com.android.internal.R.string.config_systemWellbeing)) + putExtra(Intent.EXTRA_PACKAGE_NAME, app.packageName) + } + private val appFeatureProvider = FeatureFactory.getFactory(context) .getApplicationFeatureProvider(context) - fun isAvailable() = context.packageManager.queryIntentActivitiesAsUser( - intent, ResolveInfoFlags.of(0), app.userId - ).any { resolveInfo -> - resolveInfo?.activityInfo?.applicationInfo?.isSystemApp == true - } + val isAvailableFlow = flow { emit(resolveIntent() != null) }.flowOn(Dispatchers.Default) + + // Resolve the intent first with PackageManager.MATCH_SYSTEM_ONLY flag to ensure that + // only system apps are resolved. + private fun resolveIntent(): ResolveInfo? = + context.packageManager.resolveActivityAsUser( + intent, + PackageManager.MATCH_SYSTEM_ONLY, + app.userId, + ) fun isEnabled() = app.hasFlag(ApplicationInfo.FLAG_INSTALLED) - val summaryLiveData = liveData(Dispatchers.IO) { - emit(appFeatureProvider.getTimeSpentInApp(app.packageName).toString()) - } + val summaryFlow = + flow { emit(appFeatureProvider.getTimeSpentInApp(app.packageName).toString()) } + .flowOn(Dispatchers.Default) fun startActivity() { context.startActivityAsUser(intent, app.userHandle) diff --git a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt index 6cc3e3c57e7..32b7e779ce2 100644 --- a/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt +++ b/tests/spa_unit/src/com/android/settings/spa/app/appinfo/AppTimeSpentPreferenceTest.kt @@ -17,17 +17,16 @@ package com.android.settings.spa.app.appinfo import android.content.Context -import android.content.pm.ActivityInfo import android.content.pm.ApplicationInfo import android.content.pm.PackageManager -import android.content.pm.PackageManager.ResolveInfoFlags import android.content.pm.ResolveInfo import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.test.assertIsDisplayed -import androidx.compose.ui.test.assertIsEnabled import androidx.compose.ui.test.assertIsNotDisplayed import androidx.compose.ui.test.assertIsNotEnabled +import androidx.compose.ui.test.hasText +import androidx.compose.ui.test.isEnabled import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.onRoot @@ -35,12 +34,13 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.android.settings.R import com.android.settings.testutils.FakeFeatureFactory +import com.android.settingslib.spa.testutils.any +import com.android.settingslib.spa.testutils.waitUntilExists import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -import org.mockito.Mockito.any import org.mockito.Mockito.anyInt import org.mockito.Spy import org.mockito.junit.MockitoJUnit @@ -59,39 +59,26 @@ class AppTimeSpentPreferenceTest { private val context: Context = ApplicationProvider.getApplicationContext() @Mock - private lateinit var packageManager: PackageManager + private lateinit var mockPackageManager: PackageManager private val fakeFeatureFactory = FakeFeatureFactory() private val appFeatureProvider = fakeFeatureFactory.mockApplicationFeatureProvider @Before fun setUp() { - whenever(context.packageManager).thenReturn(packageManager) + whenever(context.packageManager).thenReturn(mockPackageManager) whenever(appFeatureProvider.getTimeSpentInApp(PACKAGE_NAME)).thenReturn(TIME_SPENT) } - private fun mockActivitiesQueryResult(resolveInfos: List) { + private fun mockActivityQueryResult(resolveInfo: ResolveInfo?) { whenever( - packageManager.queryIntentActivitiesAsUser(any(), any(), anyInt()) - ).thenReturn(resolveInfos) + mockPackageManager.resolveActivityAsUser(any(), anyInt(), anyInt()) + ).thenReturn(resolveInfo) } @Test fun noIntentHandler_notDisplay() { - mockActivitiesQueryResult(emptyList()) - - composeTestRule.setContent { - CompositionLocalProvider(LocalContext provides context) { - AppTimeSpentPreference(INSTALLED_APP) - } - } - - composeTestRule.onRoot().assertIsNotDisplayed() - } - - @Test - fun hasIntentHandler_notSystemApp_notDisplay() { - mockActivitiesQueryResult(listOf(ResolveInfo())) + mockActivityQueryResult(null) composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -104,7 +91,7 @@ class AppTimeSpentPreferenceTest { @Test fun installedApp_enabled() { - mockActivitiesQueryResult(listOf(MATCHED_RESOLVE_INFO)) + mockActivityQueryResult(ResolveInfo()) composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -112,18 +99,16 @@ class AppTimeSpentPreferenceTest { } } - composeTestRule.onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) - .assertIsDisplayed() - .assertIsEnabled() + composeTestRule.waitUntilExists( + hasText(context.getString(R.string.time_spent_in_app_pref_title)) and isEnabled() + ) composeTestRule.onNodeWithText(TIME_SPENT).assertIsDisplayed() } @Test fun notInstalledApp_disabled() { - mockActivitiesQueryResult(listOf(MATCHED_RESOLVE_INFO)) - val notInstalledApp = ApplicationInfo().apply { - packageName = PACKAGE_NAME - } + mockActivityQueryResult(ResolveInfo()) + val notInstalledApp = ApplicationInfo().apply { packageName = PACKAGE_NAME } composeTestRule.setContent { CompositionLocalProvider(LocalContext provides context) { @@ -131,25 +116,19 @@ class AppTimeSpentPreferenceTest { } } - composeTestRule.onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) + composeTestRule + .onNodeWithText(context.getString(R.string.time_spent_in_app_pref_title)) .assertIsNotEnabled() } companion object { - private const val PACKAGE_NAME = "package name" + private const val PACKAGE_NAME = "package.name" private const val TIME_SPENT = "15 minutes" - private val INSTALLED_APP = ApplicationInfo().apply { - packageName = PACKAGE_NAME - flags = ApplicationInfo.FLAG_INSTALLED - } - - private val MATCHED_RESOLVE_INFO = ResolveInfo().apply { - activityInfo = ActivityInfo().apply { - applicationInfo = ApplicationInfo().apply { - flags = ApplicationInfo.FLAG_SYSTEM - } + private val INSTALLED_APP = + ApplicationInfo().apply { + packageName = PACKAGE_NAME + flags = ApplicationInfo.FLAG_INSTALLED } - } } } From 4901c86b765f5e72075fb5e26374c097920a56f5 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Mon, 18 Nov 2024 15:53:41 -0800 Subject: [PATCH 03/23] Don't let profiles open the UserSettings overflow [DO NOT MERGE] Really, profiles aren't expected to open Settings at all. But if they do somehow, the overflow shouldn't appear. Bug: 352542820 Flag: EXEMPT bugfix Test: Try to access the overflow of the work profile by launching its Settings in adb shell am start --user 10 'com.android.settings/.Settings\$UserSettingsActivity' Change-Id: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 Merged-In: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 (cherry picked from commit 69c7f5dac580361792bbb189178653b297d06c8a) --- src/com/android/settings/users/UserSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index ee23fc379d8..56bdfba3069 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -358,8 +358,8 @@ public class UserSettings extends SettingsPreferenceFragment int pos = 0; // TODO(b/191509236): The menu item does not need to be accessible for guest users, // regardless of mGuestUserAutoCreated - if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !(isCurrentUserGuest() - && mGuestUserAutoCreated)) { + if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !mUserManager.isProfile() + && !(isCurrentUserGuest() && mGuestUserAutoCreated)) { String nickname = mUserManager.getUserName(); MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++, getResources().getString(R.string.user_remove_user_menu, nickname)); From 6f1c499e57f7fb2db0bb3a5f7c03b6fa85c2f77c Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Mon, 18 Nov 2024 15:53:41 -0800 Subject: [PATCH 04/23] Don't let profiles open the UserSettings overflow [DO NOT MERGE] Really, profiles aren't expected to open Settings at all. But if they do somehow, the overflow shouldn't appear. Bug: 352542820 Flag: EXEMPT bugfix Test: Try to access the overflow of the work profile by launching its Settings in adb shell am start --user 10 'com.android.settings/.Settings\$UserSettingsActivity' Change-Id: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 Merged-In: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 (cherry picked from commit 69c7f5dac580361792bbb189178653b297d06c8a) --- src/com/android/settings/users/UserSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index ee23fc379d8..56bdfba3069 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -358,8 +358,8 @@ public class UserSettings extends SettingsPreferenceFragment int pos = 0; // TODO(b/191509236): The menu item does not need to be accessible for guest users, // regardless of mGuestUserAutoCreated - if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !(isCurrentUserGuest() - && mGuestUserAutoCreated)) { + if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !mUserManager.isProfile() + && !(isCurrentUserGuest() && mGuestUserAutoCreated)) { String nickname = mUserManager.getUserName(); MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++, getResources().getString(R.string.user_remove_user_menu, nickname)); From 31e69deb2809887b5ea7b8b7a7893d7db90acdd2 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Mon, 18 Nov 2024 15:53:41 -0800 Subject: [PATCH 05/23] Don't let profiles open the UserSettings overflow [DO NOT MERGE] Really, profiles aren't expected to open Settings at all. But if they do somehow, the overflow shouldn't appear. Bug: 352542820 Flag: EXEMPT bugfix Test: Try to access the overflow of the work profile by launching its Settings in adb shell am start --user 10 'com.android.settings/.Settings\$UserSettingsActivity' Change-Id: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 Merged-In: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 (cherry picked from commit 69c7f5dac580361792bbb189178653b297d06c8a) --- src/com/android/settings/users/UserSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index 5ee95ddc45a..a1806fe4770 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -380,8 +380,8 @@ public class UserSettings extends SettingsPreferenceFragment int pos = 0; // TODO(b/191509236): The menu item does not need to be accessible for guest users, // regardless of mGuestUserAutoCreated - if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !(isCurrentUserGuest() - && mGuestUserAutoCreated)) { + if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !mUserManager.isProfile() + && !(isCurrentUserGuest() && mGuestUserAutoCreated)) { String nickname = mUserManager.getUserName(); MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++, getResources().getString(R.string.user_remove_user_menu, nickname)); From 44a35ac07bcc076871b8054331096aaff8ee10f0 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Mon, 18 Nov 2024 15:53:41 -0800 Subject: [PATCH 06/23] Don't let profiles open the UserSettings overflow [DO NOT MERGE] Really, profiles aren't expected to open Settings at all. But if they do somehow, the overflow shouldn't appear. Bug: 352542820 Flag: EXEMPT bugfix Test: Try to access the overflow of the work profile by launching its Settings in adb shell am start --user 10 'com.android.settings/.Settings\$UserSettingsActivity' Change-Id: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 Merged-In: I5e4c095cda3e19fa5c63c2c550a526f5da8ec5c1 (cherry picked from commit 69c7f5dac580361792bbb189178653b297d06c8a) --- src/com/android/settings/users/UserSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index ee23fc379d8..56bdfba3069 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -358,8 +358,8 @@ public class UserSettings extends SettingsPreferenceFragment int pos = 0; // TODO(b/191509236): The menu item does not need to be accessible for guest users, // regardless of mGuestUserAutoCreated - if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !(isCurrentUserGuest() - && mGuestUserAutoCreated)) { + if (!mUserCaps.mIsAdmin && canSwitchUserNow() && !mUserManager.isProfile() + && !(isCurrentUserGuest() && mGuestUserAutoCreated)) { String nickname = mUserManager.getUserName(); MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++, getResources().getString(R.string.user_remove_user_menu, nickname)); From 2e7db438aba473e3894d3b55561e8f66eefe6c64 Mon Sep 17 00:00:00 2001 From: jinjeong Date: Thu, 28 Nov 2024 01:39:50 +0000 Subject: [PATCH 07/23] New System API to launch SIM Preference in Setting Bug: b/381319469 Test: Manual FLAG: com.android.internal.telephony.flags.action_sim_preference_settings Change-Id: I91815464a2462820de4f3db1bd59e6987910089d --- AndroidManifest.xml | 9 +++++++-- .../android/settings/network/SimOnboardingActivity.kt | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 7d335c36f45..527e0dde627 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -852,10 +852,15 @@ + android:theme="@style/Theme.SpaLib.BottomSheetDialog"> + + + + + Date: Thu, 21 Nov 2024 01:03:39 +0000 Subject: [PATCH 08/23] Cleaning up quick settings flag in Settings app Removes all instances of a11y_qs_enabled. Any code that would be nontrivial to remove has been deprecated for later cleanup. Test: atest com.android.settings.accessibility Flag: EXEMPT flag cleanup Bug: 367414968 Change-Id: I81f3c9cee377535eaa552a170d58ec1a79d1da65 --- ...ingsPrimarySwitchPreferenceController.java | 149 ------------- .../accessibility/AccessibilitySettings.java | 4 +- ...cessibilityShortcutPreferenceFragment.java | 42 +--- .../AccessibilityShortcutsTutorial.java | 4 - .../accessibility/AccessibilityUtil.java | 199 ++++++------------ .../accessibility/ColorAndMotionFragment.java | 4 +- .../accessibility/PreferredShortcuts.java | 7 - ...educeBrightColorsPreferenceController.java | 24 +-- ...ccessibilityServicePreferenceFragment.java | 14 +- .../ToggleFeaturePreferenceFragment.java | 47 +---- ...ScreenMagnificationPreferenceFragment.java | 169 +++++---------- ...QuickSettingsShortcutOptionController.java | 4 +- .../ShortcutOptionPreferenceController.java | 34 ++- ...areShortcutOptionPreferenceController.java | 25 --- .../TripleTapShortcutOptionController.java | 14 -- ...ngerDoubleTapShortcutOptionController.java | 12 -- .../VolumeKeysShortcutOptionController.java | 14 -- ...PrimarySwitchPreferenceControllerTest.java | 198 ----------------- .../AccessibilitySettingsTest.java | 16 +- ...ibilityShortcutPreferenceFragmentTest.java | 24 --- .../AccessibilityShortcutsTutorialTest.java | 5 - .../accessibility/AccessibilityUtilTest.java | 90 -------- .../CaptioningFontSizeControllerTest.java | 1 - ...brationTogglePreferenceControllerTest.java | 2 +- ...tionIntensityPreferenceControllerTest.java | 4 +- ...brationTogglePreferenceControllerTest.java | 4 +- ...sibilityServicePreferenceFragmentTest.java | 79 ------- ...eColorInversionPreferenceFragmentTest.java | 19 -- ...oggleDaltonizerPreferenceFragmentTest.java | 17 -- .../ToggleFeaturePreferenceFragmentTest.java | 51 ----- ...enMagnificationPreferenceFragmentTest.java | 139 +----------- .../EditShortcutsPreferenceFragmentTest.java | 4 - ...kSettingsShortcutOptionControllerTest.java | 18 -- ...hortcutOptionPreferenceControllerTest.java | 124 ----------- ...TripleTapShortcutOptionControllerTest.java | 31 --- ...DoubleTapShortcutOptionControllerTest.java | 28 --- ...olumeKeysShortcutOptionControllerTest.java | 25 --- .../accessibility/PreferredShortcutsTest.java | 26 --- ...eBrightColorsPreferenceControllerTest.java | 24 --- 39 files changed, 159 insertions(+), 1536 deletions(-) delete mode 100644 src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java delete mode 100644 tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java diff --git a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java deleted file mode 100644 index 8a3f22d807a..00000000000 --- a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2022 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. - */ - -package com.android.settings.accessibility; - -import android.content.ComponentName; -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; - -import androidx.annotation.Nullable; -import androidx.preference.PreferenceScreen; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settingslib.PrimarySwitchPreference; -import com.android.settingslib.core.lifecycle.LifecycleObserver; -import com.android.settingslib.core.lifecycle.events.OnCreate; -import com.android.settingslib.core.lifecycle.events.OnDestroy; -import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState; - -/** PrimarySwitchPreferenceController that shows quick settings tooltip on first use. */ -public abstract class AccessibilityQuickSettingsPrimarySwitchPreferenceController - extends TogglePreferenceController - implements LifecycleObserver, OnCreate, OnDestroy, OnSaveInstanceState { - private static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow"; - private final Handler mHandler; - private PrimarySwitchPreference mPreference; - private AccessibilityQuickSettingsTooltipWindow mTooltipWindow; - private boolean mNeedsQSTooltipReshow = false; - - /** Returns the accessibility tile component name. */ - @Nullable - abstract ComponentName getTileComponentName(); - - /** Returns the accessibility tile tooltip content. */ - abstract CharSequence getTileTooltipContent(); - - public AccessibilityQuickSettingsPrimarySwitchPreferenceController(Context context, - String preferenceKey) { - super(context, preferenceKey); - mHandler = new Handler(context.getMainLooper()); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - // Restore the tooltip. - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) { - mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW); - } - } - } - - @Override - public void onDestroy() { - mHandler.removeCallbacksAndMessages(null); - final boolean isTooltipWindowShowing = mTooltipWindow != null && mTooltipWindow.isShowing(); - if (isTooltipWindowShowing) { - mTooltipWindow.dismiss(); - } - } - - @Override - public void onSaveInstanceState(Bundle outState) { - final boolean isTooltipWindowShowing = mTooltipWindow != null && mTooltipWindow.isShowing(); - if (mNeedsQSTooltipReshow || isTooltipWindowShowing) { - outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true); - } - } - - @Override - public void displayPreference(PreferenceScreen screen) { - super.displayPreference(screen); - mPreference = screen.findPreference(getPreferenceKey()); - if (mNeedsQSTooltipReshow) { - mHandler.post(this::showQuickSettingsTooltipIfNeeded); - } - } - - @Override - public boolean setChecked(boolean isChecked) { - if (isChecked) { - showQuickSettingsTooltipIfNeeded(); - } - return isChecked; - } - - @Override - public boolean isChecked() { - return false; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_accessibility; - } - - private void showQuickSettingsTooltipIfNeeded() { - if (mPreference == null) { - // Returns if no preference found by slice highlight menu. - return; - } - - final ComponentName tileComponentName = getTileComponentName(); - if (tileComponentName == null) { - // Returns if no tile service assigned. - return; - } - - if (!mNeedsQSTooltipReshow && AccessibilityQuickSettingUtils.hasValueInSharedPreferences( - mContext, tileComponentName)) { - // Returns if quick settings tooltip only show once. - return; - } - - // TODO (287728819): Move tooltip showing to SystemUI - // Since the lifecycle of controller is independent of that of the preference, doing - // null check on switch is a temporary solution for the case that switch view - // is not ready when we would like to show the tooltip. If the switch is not ready, - // we give up showing the tooltip and also do not reshow it in the future. - if (mPreference.getSwitch() != null) { - mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext); - mTooltipWindow.setup(getTileTooltipContent(), - R.drawable.accessibility_auto_added_qs_tooltip_illustration); - mTooltipWindow.showAtTopCenter(mPreference.getSwitch()); - } - AccessibilityQuickSettingUtils.optInValueToSharedPreferences(mContext, tileComponentName); - mNeedsQSTooltipReshow = false; - } -} diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java index 801d3ee223c..62b0f3460f8 100644 --- a/src/com/android/settings/accessibility/AccessibilitySettings.java +++ b/src/com/android/settings/accessibility/AccessibilitySettings.java @@ -180,9 +180,7 @@ public class AccessibilitySettings extends DashboardFragment implements // Observe changes from accessibility selection menu shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE); - if (android.view.accessibility.Flags.a11yQsShortcut()) { - shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); - } + shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_STICKY_KEYS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SLOW_KEYS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS); diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java index 91d75f34631..104b35a9fbe 100644 --- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java +++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java @@ -31,7 +31,6 @@ import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; -import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -114,9 +113,7 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted final List shortcutFeatureKeys = new ArrayList<>(); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE); - if (android.view.accessibility.Flags.a11yQsShortcut()) { - shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); - } + shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); mSettingsContentObserver = new AccessibilitySettingsContentObserver(new Handler()); mSettingsContentObserver.registerKeysToObserverCallback(shortcutFeatureKeys, key -> { updateShortcutPreferenceData(); @@ -374,38 +371,13 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted showQuickSettingsTooltipIfNeeded(); } + /** + * @deprecated made obsolete by quick settings rollout. + * + * (TODO 367414968: finish removal.) + */ + @Deprecated private void showQuickSettingsTooltipIfNeeded() { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - // Don't show Quick Settings tooltip - return; - } - final ComponentName tileComponentName = getTileComponentName(); - if (tileComponentName == null) { - // Returns if no tile service assigned. - return; - } - - if (!mNeedsQSTooltipReshow && AccessibilityQuickSettingUtils.hasValueInSharedPreferences( - getContext(), tileComponentName)) { - // Returns if quick settings tooltip only show once. - return; - } - - final CharSequence content = getTileTooltipContent(mNeedsQSTooltipType); - if (TextUtils.isEmpty(content)) { - // Returns if no content of tile tooltip assigned. - return; - } - - final int imageResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT - ? R.drawable.accessibility_qs_tooltip_illustration - : R.drawable.accessibility_auto_added_qs_tooltip_illustration; - mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext()); - mTooltipWindow.setup(content, imageResId); - mTooltipWindow.showAtTopCenter(getView()); - AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(), - tileComponentName); - mNeedsQSTooltipReshow = false; } /** diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java b/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java index c613181d489..9386ba0a70b 100644 --- a/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java +++ b/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java @@ -496,10 +496,6 @@ public final class AccessibilityShortcutsTutorial { if ((shortcutTypes & shortcutType) == 0) { continue; } - if ((shortcutTypes & QUICK_SETTINGS) == QUICK_SETTINGS - && !android.view.accessibility.Flags.a11yQsShortcut()) { - continue; - } tutorialPages.add( createShortcutTutorialPage( context, shortcutType, buttonMode, featureName, inSetupWizard)); diff --git a/src/com/android/settings/accessibility/AccessibilityUtil.java b/src/com/android/settings/accessibility/AccessibilityUtil.java index 82d32815bf5..d31720dc302 100644 --- a/src/com/android/settings/accessibility/AccessibilityUtil.java +++ b/src/com/android/settings/accessibility/AccessibilityUtil.java @@ -61,7 +61,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Set; -import java.util.StringJoiner; /** Provides utility methods to accessibility settings only. */ public final class AccessibilityUtil { @@ -203,28 +202,23 @@ public final class AccessibilityUtil { * @param context The current context. * @param shortcutTypes A combination of {@link UserShortcutType}. * @param componentName The component name that need to be opted in Settings. + * + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated static void optInAllValuesToSettings(Context context, int shortcutTypes, @NonNull ComponentName componentName) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ true, - shortcutTypes, - Set.of(componentName.flattenToString()), - UserHandle.myUserId() - ); - } - - return; - } - - if ((shortcutTypes & SOFTWARE) == SOFTWARE) { - optInValueToSettings(context, SOFTWARE, componentName); - } - if (((shortcutTypes & HARDWARE) == HARDWARE)) { - optInValueToSettings(context, HARDWARE, componentName); + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ true, + shortcutTypes, + Set.of(componentName.flattenToString()), + UserHandle.myUserId() + ); } } @@ -234,38 +228,25 @@ public final class AccessibilityUtil { * @param context The current context. * @param shortcutType The preferred shortcut type user selected. * @param componentName The component name that need to be opted in Settings. + * + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated @VisibleForTesting static void optInValueToSettings(Context context, @UserShortcutType int shortcutType, @NonNull ComponentName componentName) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ true, - shortcutType, - Set.of(componentName.flattenToString()), - UserHandle.myUserId() - ); - } - return; + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ true, + shortcutType, + Set.of(componentName.flattenToString()), + UserHandle.myUserId() + ); } - - final String targetKey = convertKeyFromSettings(shortcutType); - final String targetString = Settings.Secure.getString(context.getContentResolver(), - targetKey); - - if (hasValueInSettings(context, shortcutType, componentName)) { - return; - } - - final StringJoiner joiner = new StringJoiner(String.valueOf(COMPONENT_NAME_SEPARATOR)); - if (!TextUtils.isEmpty(targetString)) { - joiner.add(targetString); - } - joiner.add(componentName.flattenToString()); - - Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString()); } /** @@ -275,27 +256,23 @@ public final class AccessibilityUtil { * @param context The current context. * @param shortcutTypes A combination of {@link UserShortcutType}. * @param componentName The component name that need to be opted out from Settings. + * + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated static void optOutAllValuesFromSettings(Context context, int shortcutTypes, @NonNull ComponentName componentName) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ false, - shortcutTypes, - Set.of(componentName.flattenToString()), - UserHandle.myUserId() - ); - } - return; - } - - if ((shortcutTypes & SOFTWARE) == SOFTWARE) { - optOutValueFromSettings(context, SOFTWARE, componentName); - } - if (((shortcutTypes & HARDWARE) == HARDWARE)) { - optOutValueFromSettings(context, HARDWARE, componentName); + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ false, + shortcutTypes, + Set.of(componentName.flattenToString()), + UserHandle.myUserId() + ); } } @@ -305,42 +282,25 @@ public final class AccessibilityUtil { * @param context The current context. * @param shortcutType The preferred shortcut type user selected. * @param componentName The component name that need to be opted out from Settings. + * + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated @VisibleForTesting static void optOutValueFromSettings(Context context, @UserShortcutType int shortcutType, @NonNull ComponentName componentName) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ false, - shortcutType, - Set.of(componentName.flattenToString()), - UserHandle.myUserId() - ); - } - return; + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ false, + shortcutType, + Set.of(componentName.flattenToString()), + UserHandle.myUserId() + ); } - - final StringJoiner joiner = new StringJoiner(String.valueOf(COMPONENT_NAME_SEPARATOR)); - final String targetKey = convertKeyFromSettings(shortcutType); - final String targetString = Settings.Secure.getString(context.getContentResolver(), - targetKey); - - if (TextUtils.isEmpty(targetString)) { - return; - } - - sStringColonSplitter.setString(targetString); - while (sStringColonSplitter.hasNext()) { - final String name = sStringColonSplitter.next(); - if (TextUtils.isEmpty(name) || (componentName.flattenToString()).equals(name)) { - continue; - } - joiner.add(name); - } - - Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString()); } /** @@ -354,11 +314,6 @@ public final class AccessibilityUtil { static boolean hasValuesInSettings(Context context, int shortcutTypes, @NonNull ComponentName componentName) { for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) { - if (!android.view.accessibility.Flags.a11yQsShortcut()) { - if ((shortcutType & QUICK_SETTINGS) == QUICK_SETTINGS) { - continue; - } - } if (!android.provider.Flags.a11yStandaloneGestureEnabled()) { if ((shortcutType & GESTURE) == GESTURE) { continue; @@ -379,15 +334,16 @@ public final class AccessibilityUtil { * @param shortcutType The preferred shortcut type user selected. * @param componentName The component name that need to be checked existed in Settings. * @return {@code true} if componentName existed in Settings. + * + * @deprecated use + * {@link ShortcutUtils#isShortcutContained(Context, int, String)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated @VisibleForTesting static boolean hasValueInSettings(Context context, @UserShortcutType int shortcutType, @NonNull ComponentName componentName) { - if (!android.view.accessibility.Flags.a11yQsShortcut() - && (shortcutType & QUICK_SETTINGS) == QUICK_SETTINGS) { - return false; - } - return ShortcutUtils.getShortcutTargetsFromSettings( context, shortcutType, UserHandle.myUserId() ).contains(componentName.flattenToString()); @@ -405,11 +361,6 @@ public final class AccessibilityUtil { @NonNull ComponentName componentName) { int shortcutTypes = DEFAULT; for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) { - if (!android.view.accessibility.Flags.a11yQsShortcut()) { - if ((shortcutType & QUICK_SETTINGS) == QUICK_SETTINGS) { - continue; - } - } if (!android.provider.Flags.a11yStandaloneGestureEnabled()) { if ((shortcutType & GESTURE) == GESTURE) { continue; @@ -428,23 +379,15 @@ public final class AccessibilityUtil { * * @param shortcutType The shortcut type. * @return Mapping key in Settings. + * + * @deprecated use + * {@link ShortcutUtils#convertToKey(int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated static String convertKeyFromSettings(@UserShortcutType int shortcutType) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - return ShortcutUtils.convertToKey(shortcutType); - } - - switch (shortcutType) { - case SOFTWARE: - return Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS; - case HARDWARE: - return Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE; - case TRIPLETAP: - return Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED; - default: - throw new IllegalArgumentException( - "Unsupported userShortcutType " + shortcutType); - } + return ShortcutUtils.convertToKey(shortcutType); } /** @@ -521,10 +464,6 @@ public final class AccessibilityUtil { final List list = new ArrayList<>(); for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) { - if (!android.view.accessibility.Flags.a11yQsShortcut() - && (shortcutType & QUICK_SETTINGS) == QUICK_SETTINGS) { - continue; - } if (!android.provider.Flags.a11yStandaloneGestureEnabled() && (shortcutType & GESTURE) == GESTURE) { continue; diff --git a/src/com/android/settings/accessibility/ColorAndMotionFragment.java b/src/com/android/settings/accessibility/ColorAndMotionFragment.java index 7a7c21dd1af..6e9037fcd59 100644 --- a/src/com/android/settings/accessibility/ColorAndMotionFragment.java +++ b/src/com/android/settings/accessibility/ColorAndMotionFragment.java @@ -77,9 +77,7 @@ public class ColorAndMotionFragment extends DashboardFragment { mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED); mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE); mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); - if (android.view.accessibility.Flags.a11yQsShortcut()) { - mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); - } + mShortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); if (Flags.forceInvertColor()) { mShortcutFeatureKeys.add(ToggleForceInvertPreferenceController.SETTINGS_KEY); } diff --git a/src/com/android/settings/accessibility/PreferredShortcuts.java b/src/com/android/settings/accessibility/PreferredShortcuts.java index 9006609091d..526b1fa8b39 100644 --- a/src/com/android/settings/accessibility/PreferredShortcuts.java +++ b/src/com/android/settings/accessibility/PreferredShortcuts.java @@ -17,7 +17,6 @@ package com.android.settings.accessibility; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.DEFAULT; -import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; import android.content.ComponentName; @@ -25,7 +24,6 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.UserHandle; import android.util.ArrayMap; -import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; @@ -123,11 +121,6 @@ public final class PreferredShortcuts { @NonNull Context context, @NonNull Set components) { final Map> shortcutTypeToTargets = new ArrayMap<>(); for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) { - if (!Flags.a11yQsShortcut() - && shortcutType == QUICK_SETTINGS) { - // Skip saving quick setting as preferred shortcut option when flag is not enabled - continue; - } shortcutTypeToTargets.put( shortcutType, ShortcutUtils.getShortcutTargetsFromSettings( diff --git a/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceController.java b/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceController.java index e7f59f49974..4e70103cfc7 100644 --- a/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceController.java +++ b/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceController.java @@ -16,9 +16,6 @@ package com.android.settings.accessibility; -import static com.android.internal.accessibility.AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_TILE_SERVICE_COMPONENT_NAME; - -import android.content.ComponentName; import android.content.Context; import android.database.ContentObserver; import android.hardware.display.ColorDisplayManager; @@ -29,12 +26,12 @@ import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; -import androidx.annotation.Nullable; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.server.display.feature.flags.Flags; import com.android.settings.R; +import com.android.settings.core.TogglePreferenceController; import com.android.settingslib.PrimarySwitchPreference; import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.events.OnStart; @@ -42,7 +39,7 @@ import com.android.settingslib.core.lifecycle.events.OnStop; /** PreferenceController that shows the Reduce Bright Colors summary */ public class ReduceBrightColorsPreferenceController - extends AccessibilityQuickSettingsPrimarySwitchPreferenceController + extends TogglePreferenceController implements LifecycleObserver, OnStart, OnStop { private ContentObserver mSettingsContentObserver; private PrimarySwitchPreference mPreference; @@ -72,7 +69,6 @@ public class ReduceBrightColorsPreferenceController @Override public boolean setChecked(boolean isChecked) { - super.setChecked(isChecked); return mColorDisplayManager.setReduceBrightColorsActivated(isChecked); } @@ -125,20 +121,4 @@ public class ReduceBrightColorsPreferenceController public void onStop() { mContext.getContentResolver().unregisterContentObserver(mSettingsContentObserver); } - - @Nullable - @Override - protected ComponentName getTileComponentName() { - // TODO: When clean up the feature flag, change the parent class from - // AccessibilityQuickSettingsPrimarySwitchPreferenceController to - // TogglePreferenceController - return android.view.accessibility.Flags.a11yQsShortcut() - ? null : REDUCE_BRIGHT_COLORS_TILE_SERVICE_COMPONENT_NAME; - } - - @Override - CharSequence getTileTooltipContent() { - return mContext.getText( - R.string.accessibility_reduce_bright_colors_auto_added_qs_tooltip_content); - } } diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java index e41d857bbdb..5ccea524cd0 100644 --- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java @@ -452,15 +452,11 @@ public class ToggleAccessibilityServicePreferenceFragment extends @Override protected int getDefaultShortcutTypes() { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityServiceInfo info = getAccessibilityServiceInfo(); - boolean isAccessibilityTool = info != null && info.isAccessibilityTool(); - return !isAccessibilityTool || getTileComponentName() == null - ? super.getDefaultShortcutTypes() - : ShortcutConstants.UserShortcutType.QUICK_SETTINGS; - } - - return super.getDefaultShortcutTypes(); + AccessibilityServiceInfo info = getAccessibilityServiceInfo(); + boolean isAccessibilityTool = info != null && info.isAccessibilityTool(); + return !isAccessibilityTool || getTileComponentName() == null + ? super.getDefaultShortcutTypes() + : ShortcutConstants.UserShortcutType.QUICK_SETTINGS; } private void onAllowButtonFromEnableToggleClicked() { diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java index a9f422e3749..b7f46025349 100644 --- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java @@ -167,9 +167,7 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment final List shortcutFeatureKeys = new ArrayList<>(); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS); shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE); - if (android.view.accessibility.Flags.a11yQsShortcut()) { - shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); - } + shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_QS_TARGETS); return shortcutFeatureKeys; } @@ -750,44 +748,13 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment showQuickSettingsTooltipIfNeeded(); } + /** + * @deprecated made obsolete by quick settings rollout. + * + * (TODO 367414968: finish removal.) + */ + @Deprecated private void showQuickSettingsTooltipIfNeeded() { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - // Don't show Quick Settings tooltip - return; - } - final ComponentName tileComponentName = getTileComponentName(); - if (tileComponentName == null) { - // Returns if no tile service assigned. - return; - } - - Activity activity = getActivity(); - if (activity != null && WizardManagerHelper.isAnySetupWizard(activity.getIntent())) { - // Don't show QuickSettingsTooltip in Setup Wizard - return; - } - - if (!mNeedsQSTooltipReshow && AccessibilityQuickSettingUtils.hasValueInSharedPreferences( - getContext(), tileComponentName)) { - // Returns if quick settings tooltip only show once. - return; - } - - final CharSequence content = getTileTooltipContent(mNeedsQSTooltipType); - if (TextUtils.isEmpty(content)) { - // Returns if no content of tile tooltip assigned. - return; - } - - final int imageResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT - ? R.drawable.accessibility_qs_tooltip_illustration - : R.drawable.accessibility_auto_added_qs_tooltip_illustration; - mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext()); - mTooltipWindow.setup(content, imageResId); - mTooltipWindow.showAtTopCenter(getView()); - AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(), - tileComponentName); - mNeedsQSTooltipReshow = false; } /** Returns user visible name of the tile by given {@link ComponentName}. */ diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java index 68089d50d7e..f2254609ade 100644 --- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java @@ -56,6 +56,7 @@ import androidx.preference.PreferenceCategory; import androidx.preference.SwitchPreferenceCompat; import com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType; +import com.android.internal.accessibility.util.ShortcutUtils; import com.android.internal.annotations.VisibleForTesting; import com.android.server.accessibility.Flags; import com.android.settings.DialogCreatable; @@ -74,7 +75,6 @@ import com.google.android.setupcompat.util.WizardManagerHelper; import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.util.StringJoiner; import java.util.stream.Stream; /** @@ -203,13 +203,13 @@ public class ToggleScreenMagnificationPreferenceFragment extends } final PreferenceCategory generalCategory = findPreference(KEY_GENERAL_CATEGORY); - // LINT.IfChange(:preference_list) + // LINT.IfChange(preference_list) addMagnificationModeSetting(generalCategory); addFollowTypingSetting(generalCategory); addOneFingerPanningSetting(generalCategory); addAlwaysOnSetting(generalCategory); addJoystickSetting(generalCategory); - // LINT.ThenChange(:search_data) + // LINT.ThenChange(search_data) } @Override @@ -588,70 +588,29 @@ public class ToggleScreenMagnificationPreferenceFragment extends optInMagnificationValueToSettings(context, TWOFINGER_DOUBLETAP); } } - if (android.view.accessibility.Flags.a11yQsShortcut()) { - if (((shortcutTypes & QUICK_SETTINGS) - == QUICK_SETTINGS)) { - optInMagnificationValueToSettings(context, QUICK_SETTINGS); - } + if (((shortcutTypes & QUICK_SETTINGS) + == QUICK_SETTINGS)) { + optInMagnificationValueToSettings(context, QUICK_SETTINGS); } } + /** + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) + */ + @Deprecated private static void optInMagnificationValueToSettings( Context context, @UserShortcutType int shortcutType) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ true, - shortcutType, - Set.of(MAGNIFICATION_CONTROLLER_NAME), - UserHandle.myUserId() - ); - } - return; - } - - if (shortcutType == TRIPLETAP) { - Settings.Secure.putInt(context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, ON); - return; - } - - if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) { - if (shortcutType == TWOFINGER_DOUBLETAP) { - Settings.Secure.putInt( - context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, - ON); - return; - } - } - - if (hasMagnificationValueInSettings(context, shortcutType)) { - return; - } - - final String targetKey = AccessibilityUtil.convertKeyFromSettings(shortcutType); - final String targetString = Settings.Secure.getString(context.getContentResolver(), - targetKey); - final StringJoiner joiner = new StringJoiner(String.valueOf(COMPONENT_NAME_SEPARATOR)); - - if (!TextUtils.isEmpty(targetString)) { - joiner.add(targetString); - } - joiner.add(MAGNIFICATION_CONTROLLER_NAME); - - Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString()); - // The size setting defaults to unknown. If the user has ever manually changed the size - // before, we do not automatically change it. - if (shortcutType == SOFTWARE - && Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.UNKNOWN) - == FloatingMenuSizePreferenceController.Size.UNKNOWN) { - Settings.Secure.putInt(context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.LARGE); + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ true, + shortcutType, + Set.of(MAGNIFICATION_CONTROLLER_NAME), + UserHandle.myUserId() + ); } } @@ -676,65 +635,30 @@ public class ToggleScreenMagnificationPreferenceFragment extends optOutMagnificationValueFromSettings(context, TWOFINGER_DOUBLETAP); } } - if (android.view.accessibility.Flags.a11yQsShortcut()) { - if (((shortcutTypes & QUICK_SETTINGS) + if (((shortcutTypes & QUICK_SETTINGS) == QUICK_SETTINGS)) { - optOutMagnificationValueFromSettings(context, QUICK_SETTINGS); - } + optOutMagnificationValueFromSettings(context, QUICK_SETTINGS); } } + /** + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) + */ + @Deprecated private static void optOutMagnificationValueFromSettings(Context context, @UserShortcutType int shortcutType) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets( - /* enable= */ false, - shortcutType, - Set.of(MAGNIFICATION_CONTROLLER_NAME), - UserHandle.myUserId() - ); - } - return; + AccessibilityManager a11yManager = context.getSystemService(AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets( + /* enable= */ false, + shortcutType, + Set.of(MAGNIFICATION_CONTROLLER_NAME), + UserHandle.myUserId() + ); } - - if (shortcutType == TRIPLETAP) { - Settings.Secure.putInt(context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, OFF); - return; - } - - if (Flags.enableMagnificationMultipleFingerMultipleTapGesture()) { - if (shortcutType == TWOFINGER_DOUBLETAP) { - Settings.Secure.putInt( - context.getContentResolver(), - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, - OFF); - return; - } - } - - final String targetKey = AccessibilityUtil.convertKeyFromSettings(shortcutType); - final String targetString = Settings.Secure.getString(context.getContentResolver(), - targetKey); - - if (TextUtils.isEmpty(targetString)) { - return; - } - - final StringJoiner joiner = new StringJoiner(String.valueOf(COMPONENT_NAME_SEPARATOR)); - - sStringColonSplitter.setString(targetString); - while (sStringColonSplitter.hasNext()) { - final String name = sStringColonSplitter.next(); - if (TextUtils.isEmpty(name) || MAGNIFICATION_CONTROLLER_NAME.equals(name)) { - continue; - } - joiner.add(name); - } - - Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString()); } @VisibleForTesting @@ -788,15 +712,16 @@ public class ToggleScreenMagnificationPreferenceFragment extends return false; } + /** + * @deprecated use + * {@link ShortcutUtils#getEnabledShortcutTypes(Context, String)} instead. + * + * (TODO 367414968: finish removal.) + */ + @Deprecated private static int getUserShortcutTypeFromSettings(Context context) { int shortcutTypes = DEFAULT; for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) { - if ((shortcutType & (TWOFINGER_DOUBLETAP | QUICK_SETTINGS | GESTURE | TRIPLETAP)) - == shortcutType - && !android.view.accessibility.Flags.a11yQsShortcut()) { - // These shortcuts will throw if we try to look up their settings without the flag. - continue; - } if (hasMagnificationValueInSettings(context, shortcutType)) { shortcutTypes |= shortcutType; } @@ -831,7 +756,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider() { - // LINT.IfChange(:search_data) + // LINT.IfChange(search_data) @Override public List getRawDataToIndex(Context context, boolean enabled) { @@ -887,7 +812,7 @@ public class ToggleScreenMagnificationPreferenceFragment extends } return niks; } - // LINT.ThenChange(:preference_list) + // LINT.ThenChange(preference_list) private SearchIndexableRaw createPreferenceSearchData( Context context, Preference pref) { diff --git a/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionController.java b/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionController.java index eeecd1f3050..892ae1ef30d 100644 --- a/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionController.java +++ b/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionController.java @@ -25,7 +25,6 @@ import android.os.UserHandle; import android.service.quicksettings.TileService; import android.util.ArraySet; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.preference.Preference; @@ -82,8 +81,7 @@ public class QuickSettingsShortcutOptionController extends ShortcutOptionPrefere @Override protected boolean isShortcutAvailable() { - return Flags.a11yQsShortcut() - && TileService.isQuickSettingsSupported() + return TileService.isQuickSettingsSupported() && allTargetsHasQsTile() && allTargetsHasValidQsTileUseCase(); } diff --git a/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreferenceController.java b/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreferenceController.java index defb256c8f5..afb5acf272c 100644 --- a/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreferenceController.java +++ b/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreferenceController.java @@ -19,7 +19,6 @@ package com.android.settings.accessibility.shortcuts; import android.content.Context; import android.os.UserHandle; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.preference.Preference; @@ -111,36 +110,27 @@ public abstract class ShortcutOptionPreferenceController extends BasePreferenceC return !targets.isEmpty() && targets.containsAll(getShortcutTargets()); } + /** * Enable or disable the shortcut for the given accessibility features. + * + * @deprecated use + * {@link AccessibilityManager#enableShortcutsForTargets(boolean, int, Set, int)} instead. + * + * (TODO 367414968: finish removal.) */ + @Deprecated protected void enableShortcutForTargets(boolean enable) { Set shortcutTargets = getShortcutTargets(); @ShortcutConstants.UserShortcutType int shortcutType = getShortcutType(); - if (Flags.a11yQsShortcut()) { - AccessibilityManager a11yManager = mContext.getSystemService( - AccessibilityManager.class); - if (a11yManager != null) { - a11yManager.enableShortcutsForTargets(enable, shortcutType, shortcutTargets, - UserHandle.myUserId()); - } - return; + AccessibilityManager a11yManager = mContext.getSystemService( + AccessibilityManager.class); + if (a11yManager != null) { + a11yManager.enableShortcutsForTargets(enable, shortcutType, shortcutTargets, + UserHandle.myUserId()); } - - if (enable) { - for (String target : shortcutTargets) { - ShortcutUtils.optInValueToSettings(mContext, shortcutType, target); - } - } else { - for (String target : shortcutTargets) { - ShortcutUtils.optOutValueFromSettings(mContext, shortcutType, target); - } - } - ShortcutUtils.updateInvisibleToggleAccessibilityServiceEnableState( - mContext, shortcutTargets, UserHandle.myUserId()); } - /** * Returns true when the user can associate a shortcut to the targets */ diff --git a/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceController.java b/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceController.java index 861bebd83ef..3f35d1cf4b8 100644 --- a/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceController.java +++ b/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceController.java @@ -19,14 +19,11 @@ package com.android.settings.accessibility.shortcuts; import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME; import android.content.Context; -import android.provider.Settings; import android.view.View; -import android.view.accessibility.Flags; import com.android.internal.accessibility.common.ShortcutConstants; import com.android.settings.R; import com.android.settings.accessibility.AccessibilityButtonFragment; -import com.android.settings.accessibility.FloatingMenuSizePreferenceController; import com.android.settings.core.SubSettingLauncher; import com.android.settings.utils.AnnotationSpan; @@ -62,26 +59,4 @@ public abstract class SoftwareShortcutOptionPreferenceController R.string.accessibility_shortcut_edit_dialog_summary_software_floating), linkInfo); } - - @Override - protected void enableShortcutForTargets(boolean enable) { - super.enableShortcutForTargets(enable); - if (Flags.a11yQsShortcut()) { - return; - } - - if (enable) { - // Update the A11y FAB size to large when the Magnification shortcut is enabled - // and the user hasn't changed the floating button size - if (isMagnificationInTargets() - && Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.UNKNOWN) - == FloatingMenuSizePreferenceController.Size.UNKNOWN) { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.LARGE); - } - } - } } diff --git a/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionController.java b/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionController.java index bdec9a6f290..3f0d80a5966 100644 --- a/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionController.java +++ b/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionController.java @@ -20,7 +20,6 @@ import static com.android.internal.accessibility.AccessibilityShortcutController import android.content.Context; import android.provider.Settings; -import android.view.accessibility.Flags; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; @@ -99,17 +98,4 @@ public class TripleTapShortcutOptionController extends ShortcutOptionPreferenceC Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, AccessibilityUtil.State.OFF) == AccessibilityUtil.State.ON; } - - @Override - protected void enableShortcutForTargets(boolean enable) { - if (Flags.a11yQsShortcut()) { - super.enableShortcutForTargets(enable); - return; - } - - Settings.Secure.putInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, - enable ? AccessibilityUtil.State.ON : AccessibilityUtil.State.OFF); - } } diff --git a/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionController.java b/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionController.java index 26e8386efbc..c88a1ccb1a2 100644 --- a/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionController.java +++ b/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionController.java @@ -86,16 +86,4 @@ public class TwoFingerDoubleTapShortcutOptionController Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, AccessibilityUtil.State.OFF) == AccessibilityUtil.State.ON; } - - @Override - protected void enableShortcutForTargets(boolean enable) { - if (android.view.accessibility.Flags.a11yQsShortcut()) { - super.enableShortcutForTargets(enable); - return; - } - Settings.Secure.putInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, - enable ? AccessibilityUtil.State.ON : AccessibilityUtil.State.OFF); - } } diff --git a/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionController.java b/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionController.java index f3da35b66da..eb7b82d389f 100644 --- a/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionController.java +++ b/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionController.java @@ -17,14 +17,12 @@ package com.android.settings.accessibility.shortcuts; import android.content.Context; -import android.view.accessibility.Flags; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; import com.android.internal.accessibility.common.ShortcutConstants; import com.android.settings.R; -import com.android.settings.accessibility.AccessibilityUtil; /** * A controller handles displaying the volume keys shortcut option preference and @@ -61,16 +59,4 @@ public class VolumeKeysShortcutOptionController extends ShortcutOptionPreference protected boolean isShortcutAvailable() { return true; } - - @Override - protected void enableShortcutForTargets(boolean enable) { - super.enableShortcutForTargets(enable); - if (Flags.a11yQsShortcut()) { - return; - } - - if (enable) { - AccessibilityUtil.skipVolumeShortcutDialogTimeoutRestriction(mContext); - } - } } diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java deleted file mode 100644 index 08cbaae4efc..00000000000 --- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2022 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. - */ - -package com.android.settings.accessibility; - -import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_SAVED_QS_TOOLTIP_RESHOW; - -import static com.google.common.truth.Truth.assertThat; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import android.content.ComponentName; -import android.content.Context; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.widget.LinearLayout; -import android.widget.PopupWindow; - -import androidx.preference.PreferenceManager; -import androidx.preference.PreferenceScreen; -import androidx.preference.PreferenceViewHolder; -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.testutils.shadow.ShadowFragment; -import com.android.settingslib.PrimarySwitchPreference; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Answers; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; -import org.robolectric.shadow.api.Shadow; -import org.robolectric.shadows.ShadowApplication; -import org.robolectric.shadows.ShadowLooper; - -/** - * Tests for {@link AccessibilityQuickSettingsPrimarySwitchPreferenceController}. - */ -@RunWith(RobolectricTestRunner.class) -public class AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest { - - private static final String PLACEHOLDER_PACKAGE_NAME = "com.placeholder.example"; - private static final String PLACEHOLDER_TILE_CLASS_NAME = - PLACEHOLDER_PACKAGE_NAME + "tile.placeholder"; - private static final ComponentName PLACEHOLDER_TILE_COMPONENT_NAME = new ComponentName( - PLACEHOLDER_PACKAGE_NAME, PLACEHOLDER_TILE_CLASS_NAME); - private static final CharSequence PLACEHOLDER_TILE_CONTENT = - PLACEHOLDER_TILE_CLASS_NAME + ".tile.content"; - private static final String TEST_KEY = "test_pref_key"; - private static final String TEST_TITLE = "test_title"; - - @Rule - public final MockitoRule mockito = MockitoJUnit.rule(); - - @Spy - private final Context mContext = ApplicationProvider.getApplicationContext(); - - private TestAccessibilityQuickSettingsPrimarySwitchPreferenceController mController; - private PrimarySwitchPreference mPreference; - private TestFragment mFragment; - private PreferenceScreen mScreen; - private PreferenceViewHolder mHolder; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) - private PreferenceManager mPreferenceManager; - - private static PopupWindow getLatestPopupWindow() { - final ShadowApplication shadowApplication = - Shadow.extract(ApplicationProvider.getApplicationContext()); - return shadowApplication.getLatestPopupWindow(); - } - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - - mContext.setTheme(androidx.appcompat.R.style.Theme_AppCompat); - mFragment = spy(new TestFragment()); - when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager); - when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext); - when(mFragment.getContext()).thenReturn(mContext); - mScreen = spy(new PreferenceScreen(mContext, /* attrs= */ null)); - when(mScreen.getPreferenceManager()).thenReturn(mPreferenceManager); - doReturn(mScreen).when(mFragment).getPreferenceScreen(); - - mPreference = new PrimarySwitchPreference(mContext); - mPreference.setKey(TEST_KEY); - mPreference.setTitle(TEST_TITLE); - LayoutInflater inflater = LayoutInflater.from(mContext); - mHolder = PreferenceViewHolder.createInstanceForTests(inflater.inflate( - com.android.settingslib.widget.preference.twotarget.R.layout.preference_two_target, null)); - LinearLayout mWidgetView = mHolder.itemView.findViewById(android.R.id.widget_frame); - inflater.inflate(R.layout.preference_widget_primary_switch, mWidgetView, true); - mPreference.onBindViewHolder(mHolder); - - mController = new TestAccessibilityQuickSettingsPrimarySwitchPreferenceController(mContext, - TEST_KEY); - when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); - } - - @Test - public void setChecked_showTooltipView() { - mController.displayPreference(mScreen); - - mController.setChecked(true); - - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - - @Test - public void setChecked_notCallDisplayPreference_notShowTooltipView() { - // Simulates the slice highlight menu that does not call {@link #displayPreference} before - // {@link #setChecked} called. - mController.setChecked(true); - - assertThat(getLatestPopupWindow()).isNull(); - } - - @Test - public void setChecked_tooltipViewShown_notShowTooltipView() { - mController.displayPreference(mScreen); - mController.setChecked(true); - getLatestPopupWindow().dismiss(); - mController.setChecked(false); - - mController.setChecked(true); - - assertThat(getLatestPopupWindow().isShowing()).isFalse(); - } - - @Test - @Config(shadows = ShadowFragment.class) - public void restoreValueFromSavedInstanceState_showTooltipView() { - final Bundle savedInstanceState = new Bundle(); - savedInstanceState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true); - mController.onCreate(savedInstanceState); - - mController.displayPreference(mScreen); - ShadowLooper.idleMainLooper(); - - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - - public static class TestAccessibilityQuickSettingsPrimarySwitchPreferenceController - extends AccessibilityQuickSettingsPrimarySwitchPreferenceController { - - public TestAccessibilityQuickSettingsPrimarySwitchPreferenceController(Context context, - String preferenceKey) { - super(context, preferenceKey); - } - - @Override - ComponentName getTileComponentName() { - return PLACEHOLDER_TILE_COMPONENT_NAME; - } - - @Override - CharSequence getTileTooltipContent() { - return PLACEHOLDER_TILE_CONTENT; - } - } - - private static class TestFragment extends SettingsPreferenceFragment { - - @Override - protected boolean shouldSkipForInitialSUW() { - return false; - } - - @Override - public int getMetricsCategory() { - return 0; - } - } -} diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java index 36578a90e25..939b2e4b800 100644 --- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java @@ -376,21 +376,7 @@ public class AccessibilitySettingsTest { } @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onCreate_flagDisabled_haveRegisterToSpecificUrisAndActions() { - setupFragment(); - - assertUriObserversContainsClazz(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, - AccessibilitySettingsContentObserver.class).isTrue(); - assertUriObserversContainsClazz(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, - AccessibilitySettingsContentObserver.class).isTrue(); - assertUriObserversContainsClazz(Settings.Secure.ACCESSIBILITY_QS_TARGETS, - AccessibilitySettingsContentObserver.class).isFalse(); - } - - @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onCreate_flagEnabled_haveRegisterToSpecificUrisAndActions() { + public void onCreate_haveRegisterToSpecificUrisAndActions() { setupFragment(); assertUriObserversContainsClazz(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java index 9d18c44e392..ca18e269a50 100644 --- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java @@ -19,7 +19,6 @@ package com.android.settings.accessibility; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS; import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE; -import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_QS_TOOLTIP_RESHOW; import static com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType; import static com.google.common.truth.Truth.assertThat; @@ -38,14 +37,11 @@ import android.content.Context; import android.content.Intent; import android.icu.text.CaseMap; import android.os.Bundle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.accessibility.Flags; import android.widget.PopupWindow; import androidx.annotation.Nullable; @@ -156,25 +152,6 @@ public class AccessibilityShortcutPreferenceFragmentTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - @Config(shadows = ShadowFragment.class) - public void restoreValueFromSavedInstanceState_showTooltipView() { - mContext.setTheme(androidx.appcompat.R.style.Theme_AppCompat); - mFragment.showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_EDIT); - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - - final Bundle savedInstanceState = new Bundle(); - savedInstanceState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true); - mFragment.onAttach(mContext); - mFragment.onCreate(savedInstanceState); - mFragment.onCreateView(LayoutInflater.from(mContext), mock(ViewGroup.class), Bundle.EMPTY); - mFragment.onViewCreated(mFragment.getView(), savedInstanceState); - - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) @Config(shadows = ShadowFragment.class) public void showQuickSettingsTooltipIfNeeded_qsFlagOn_dontShowTooltipView() { mFragment.showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_EDIT); @@ -219,7 +196,6 @@ public class AccessibilityShortcutPreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getShortcutTypeSummary_shortcutSummaryIsCorrectlySet() { final PreferredShortcut userPreferredShortcut = new PreferredShortcut( PLACEHOLDER_COMPONENT_NAME.flattenToString(), diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutsTutorialTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutsTutorialTest.java index cd8743d595b..779866229ce 100644 --- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutsTutorialTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutsTutorialTest.java @@ -133,7 +133,6 @@ public final class AccessibilityShortcutsTutorialTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void createTutorialPages_turnOnQuickSettingShortcut_hasOnePage() { mShortcutTypes |= QUICK_SETTINGS; @@ -260,7 +259,6 @@ public final class AccessibilityShortcutsTutorialTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void createAccessibilityTutorialDialog_qsShortcut_inSuwTalkbackOn_verifyText() { mShortcutTypes |= QUICK_SETTINGS; setTouchExplorationEnabled(true); @@ -292,7 +290,6 @@ public final class AccessibilityShortcutsTutorialTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void createAccessibilityTutorialDialog_qsShortcut_notInSuwTalkbackOn_verifyText() { mShortcutTypes |= QUICK_SETTINGS; setTouchExplorationEnabled(true); @@ -318,7 +315,6 @@ public final class AccessibilityShortcutsTutorialTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void createAccessibilityTutorialDialog_qsShortcut_inSuwTalkbackOff_verifyText() { mShortcutTypes |= QUICK_SETTINGS; setTouchExplorationEnabled(false); @@ -349,7 +345,6 @@ public final class AccessibilityShortcutsTutorialTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void createAccessibilityTutorialDialog_qsShortcut_notInSuwTalkbackOff_verifyText() { mShortcutTypes |= QUICK_SETTINGS; setTouchExplorationEnabled(false); diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java index ee3d9360e2c..24db847dffa 100644 --- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java @@ -46,7 +46,6 @@ import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.test.core.app.ApplicationProvider; @@ -203,7 +202,6 @@ public final class AccessibilityUtilTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getUserShortcutTypeFromSettings_threeShortcutTypesChosen() { setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString()); setShortcut(HARDWARE, MOCK_COMPONENT_NAME.flattenToString()); @@ -220,22 +218,6 @@ public final class AccessibilityUtilTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInAllValuesToSettings_optInValue_haveMatchString() { - clearShortcuts(); - int shortcutTypes = SOFTWARE | HARDWARE; - - AccessibilityUtil.optInAllValuesToSettings(mContext, shortcutTypes, MOCK_COMPONENT_NAME); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - MOCK_COMPONENT_NAME.flattenToString()); - assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEqualTo( - MOCK_COMPONENT_NAME.flattenToString()); - - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void optInAllValuesToSettings_optInValue_callsA11yManager() { AccessibilityManager a11yManager = AccessibilityTestUtils.setupMockAccessibilityManager(mContext); @@ -252,20 +234,6 @@ public final class AccessibilityUtilTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInValueToSettings_optInValue_haveMatchString() { - setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString()); - - AccessibilityUtil.optInValueToSettings(mContext, SOFTWARE, - MOCK_COMPONENT_NAME2); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - MOCK_COMPONENT_NAME.flattenToString() + ":" - + MOCK_COMPONENT_NAME2.flattenToString()); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void optInValueToSettings_optInValue_callsA11yManager() { AccessibilityManager a11yManager = AccessibilityTestUtils.setupMockAccessibilityManager(mContext); @@ -281,37 +249,6 @@ public final class AccessibilityUtilTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInValueToSettings_optInTwoValues_haveMatchString() { - setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString()); - - AccessibilityUtil.optInValueToSettings(mContext, SOFTWARE, - MOCK_COMPONENT_NAME2); - AccessibilityUtil.optInValueToSettings(mContext, SOFTWARE, - MOCK_COMPONENT_NAME2); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - MOCK_COMPONENT_NAME.flattenToString() + ":" - + MOCK_COMPONENT_NAME2.flattenToString()); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutAllValuesToSettings_optOutValue_emptyString() { - setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString()); - setShortcut(HARDWARE, MOCK_COMPONENT_NAME.flattenToString()); - int shortcutTypes = - SOFTWARE | HARDWARE | TRIPLETAP; - - AccessibilityUtil.optOutAllValuesFromSettings(mContext, shortcutTypes, - MOCK_COMPONENT_NAME); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEmpty(); - assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEmpty(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void optOutAllValuesToSettings_optOutValue_callsA1yManager() { AccessibilityManager a11yManager = AccessibilityTestUtils.setupMockAccessibilityManager(mContext); @@ -331,31 +268,6 @@ public final class AccessibilityUtilTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutValueFromSettings_optOutValue_emptyString() { - setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString()); - - AccessibilityUtil.optOutValueFromSettings(mContext, SOFTWARE, - MOCK_COMPONENT_NAME); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEmpty(); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutValueFromSettings_optOutValue_haveMatchString() { - setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString(), - MOCK_COMPONENT_NAME2.flattenToString()); - - AccessibilityUtil.optOutValueFromSettings(mContext, SOFTWARE, - MOCK_COMPONENT_NAME2); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - MOCK_COMPONENT_NAME.flattenToString()); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void optOutValueFromSettings_optOutValue_callsA11yManager() { AccessibilityManager a11yManager = AccessibilityTestUtils.setupMockAccessibilityManager(mContext); @@ -389,7 +301,6 @@ public final class AccessibilityUtilTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void convertKeyFromSettings_shortcutTypeMultiFingersMultiTap() { assertThat(AccessibilityUtil.convertKeyFromSettings(TWOFINGER_DOUBLETAP)) .isEqualTo( @@ -397,7 +308,6 @@ public final class AccessibilityUtilTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void convertKeyFromSettings_shortcutTypeQuickSettings() { assertThat(AccessibilityUtil.convertKeyFromSettings(QUICK_SETTINGS)) .isEqualTo(Settings.Secure.ACCESSIBILITY_QS_TARGETS); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java index b00d8d899f7..c222d3fd66d 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java @@ -22,7 +22,6 @@ import static com.android.settings.accessibility.AccessibilityUtil.State.ON; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; - import static org.robolectric.Shadows.shadowOf; import android.content.Context; diff --git a/tests/robotests/src/com/android/settings/accessibility/KeyboardVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/KeyboardVibrationTogglePreferenceControllerTest.java index 78f49a66906..76b93b03c94 100644 --- a/tests/robotests/src/com/android/settings/accessibility/KeyboardVibrationTogglePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/KeyboardVibrationTogglePreferenceControllerTest.java @@ -26,8 +26,8 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import android.app.settings.SettingsEnums; import android.content.ContentResolver; diff --git a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java index 355e8c32041..da8059c25ec 100644 --- a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java @@ -30,10 +30,10 @@ import android.provider.Settings; import androidx.preference.PreferenceScreen; import androidx.test.core.app.ApplicationProvider; -import com.android.settings.core.BasePreferenceController; import com.android.settings.R; -import com.android.settings.testutils.shadow.ShadowInteractionJankMonitor; +import com.android.settings.core.BasePreferenceController; import com.android.settings.testutils.shadow.SettingsShadowResources; +import com.android.settings.testutils.shadow.ShadowInteractionJankMonitor; import com.android.settings.widget.SeekBarPreference; import com.android.settingslib.core.lifecycle.Lifecycle; diff --git a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java index 501bbb0e102..348ac45c5dd 100644 --- a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java @@ -31,9 +31,9 @@ import androidx.preference.PreferenceScreen; import androidx.preference.SwitchPreference; import androidx.test.core.app.ApplicationProvider; +import com.android.settings.R; import com.android.settings.core.BasePreferenceController; import com.android.settings.testutils.shadow.SettingsShadowResources; -import com.android.settings.R; import com.android.settingslib.core.lifecycle.Lifecycle; import org.junit.After; @@ -42,8 +42,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.robolectric.annotation.Config; import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; /** Test for {@link MediaVibrationIntensityPreferenceController}. */ @RunWith(RobolectricTestRunner.class) diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragmentTest.java index 008f542b500..70290af8a61 100644 --- a/tests/robotests/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragmentTest.java @@ -34,13 +34,8 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; -import android.platform.test.flag.junit.SetFlagsRule; -import android.provider.Settings; import android.service.quicksettings.TileService; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; @@ -55,7 +50,6 @@ import com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragm import com.android.settings.widget.SettingsMainSwitchPreference; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Answers; @@ -75,8 +69,6 @@ import java.util.Set; @RunWith(RobolectricTestRunner.class) public class ToggleAccessibilityServicePreferenceFragmentTest { - @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); - private static final String PLACEHOLDER_PACKAGE_NAME = "com.placeholder.example"; private static final String PLACEHOLDER_PACKAGE_NAME2 = "com.placeholder.example2"; private static final String PLACEHOLDER_SERVICE_CLASS_NAME = "a11yservice1"; @@ -314,30 +306,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void getDefaultShortcutTypes_noAssociatedTile_softwareTypeIsDefault() throws Throwable { - PreferredShortcuts.clearPreferredShortcuts(mContext); - setupAccessibilityServiceInfoForFragment( - /* isAccessibilityTool= */ true, - /* tileService= */ null - /* warningRequired= */); - - assertThat(mFragment.getDefaultShortcutTypes()) - .isEqualTo(ShortcutConstants.UserShortcutType.SOFTWARE); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void getDefaultShortcutTypes_hasAssociatedTile_softwareTypeIsDefault() { - PreferredShortcuts.clearPreferredShortcuts(mContext); - when(mFragment.getTileComponentName()).thenReturn(PLACEHOLDER_TILE_COMPONENT_NAME); - - assertThat(mFragment.getDefaultShortcutTypes()) - .isEqualTo(ShortcutConstants.UserShortcutType.SOFTWARE); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getDefaultShortcutTypes_isAccessibilityTool_hasAssociatedTile_qsTypeIsDefault() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -351,7 +319,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getDefaultShortcutTypes_isNotAccessibilityTool_hasAssociatedTile_softwareTypeIsDefault() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -365,7 +332,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getDefaultShortcutTypes_isAccessibilityTool_noAssociatedTile_softwareTypeIsDefault() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -379,7 +345,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void getDefaultShortcutTypes_isNotAccessibilityTool_noAssociatedTile_softwareTypeIsDefault() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -393,7 +358,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void toggleShortcutPreference_noUserPreferredShortcut_hasQsTile_enableQsShortcut() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -413,7 +377,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void toggleShortcutPreference_noUserPreferredShortcut_noQsTile_enableSoftwareShortcut() throws Throwable { PreferredShortcuts.clearPreferredShortcuts(mContext); @@ -433,47 +396,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void toggleShortcutPreference_noUserPreferredShortcut_hasQsTile_flagOff_enableSoftwareShortcut() - throws Throwable { - PreferredShortcuts.clearPreferredShortcuts(mContext); - setupAccessibilityServiceInfoForFragment( - /* isAccessibilityTool= */ true, - /* tileService= */ PLACEHOLDER_TILE_COMPONENT_NAME - /* warningRequired= */); - mFragment.mShortcutPreference = new ShortcutPreference(mContext, /* attrs= */ null); - - mFragment.mShortcutPreference.setChecked(true); - mFragment.onToggleClicked(mFragment.mShortcutPreference); - - assertThat( - Settings.Secure.getString(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)) - .contains(mFragment.mComponentName.flattenToString()); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void toggleShortcutPreference_noUserPreferredShortcut_noQsTile_flagOff_enableSoftwareShortcut() - throws Throwable { - PreferredShortcuts.clearPreferredShortcuts(mContext); - setupAccessibilityServiceInfoForFragment( - /* isAccessibilityTool= */ true, - /* tileService= */ null - /* warningRequired= */); - mFragment.mShortcutPreference = new ShortcutPreference(mContext, /* attrs= */ null); - - mFragment.mShortcutPreference.setChecked(true); - mFragment.onToggleClicked(mFragment.mShortcutPreference); - - assertThat( - Settings.Secure.getString(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)) - .contains(mFragment.mComponentName.flattenToString()); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void toggleShortcutPreference_userPreferVolumeKeysShortcut_noQsTile_enableVolumeKeysShortcut() throws Throwable { setupAccessibilityServiceInfoForFragment( @@ -498,7 +420,6 @@ public class ToggleAccessibilityServicePreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void toggleShortcutPreference_userPreferVolumeKeysShortcut_hasQsTile_enableVolumeKeysShortcut() throws Throwable { setupAccessibilityServiceInfoForFragment( diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragmentTest.java index e9711864909..cbd449305d4 100644 --- a/tests/robotests/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragmentTest.java @@ -139,25 +139,6 @@ public class ToggleColorInversionPreferenceFragmentTest { assertThat(getLatestPopupWindow()).isNull(); } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onPreferenceToggled_colorCorrectDisabled_shouldReturnTrueAndShowTooltipView() { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, OFF); - mSwitchPreference.setChecked(false); - mFragment.onAttach(mContext); - mFragment.onCreateView(LayoutInflater.from(mContext), mock(ViewGroup.class), Bundle.EMPTY); - mFragment.onViewCreated(mFragment.getView(), Bundle.EMPTY); - - mFragment.onPreferenceToggled(mSwitchPreference.getKey(), true); - - final boolean isEnabled = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, OFF) == ON; - assertThat(isEnabled).isTrue(); - assertThat(getLatestPopupWindow()).isNotNull(); - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - @Test public void onPreferenceToggled_colorCorrectEnabled_shouldReturnFalseAndNotShowTooltipView() { Settings.Secure.putInt(mContext.getContentResolver(), diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java index a33fefbb404..390a8ca6e38 100644 --- a/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java @@ -106,23 +106,6 @@ public class ToggleDaltonizerPreferenceFragmentTest { assertThat(getLatestPopupWindow()).isNull(); } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onPreferenceToggled_colorCorrectDisabled_shouldReturnTrueAndShowTooltipView() { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, OFF); - ToggleDaltonizerPreferenceFragment fragment = getFragmentInResumedState(); - SettingsMainSwitchPreference switchPreference = getMainFeatureToggle(fragment); - - fragment.onPreferenceToggled(switchPreference.getKey(), true); - - final boolean isEnabled = Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, OFF) == ON; - assertThat(isEnabled).isTrue(); - assertThat(getLatestPopupWindow()).isNotNull(); - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - @Test public void onPreferenceToggled_colorCorrectEnabled_shouldReturnFalseAndNotShowTooltipView() { Settings.Secure.putInt(mContext.getContentResolver(), diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java index 844fabe2647..87ab52dbab5 100644 --- a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java @@ -26,7 +26,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -38,7 +37,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.icu.text.CaseMap; import android.os.Bundle; -import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; @@ -142,7 +140,6 @@ public class ToggleFeaturePreferenceFragmentTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) @Config(shadows = {ShadowFragment.class}) public void onResume_flagEnabled_haveRegisterToSpecificUris() { mFragment.onAttach(mContext); @@ -166,31 +163,6 @@ public class ToggleFeaturePreferenceFragmentTest { any(AccessibilitySettingsContentObserver.class)); } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - @Config(shadows = {ShadowFragment.class}) - public void onResume_flagDisabled_haveRegisterToSpecificUris() { - mFragment.onAttach(mContext); - mFragment.onCreate(Bundle.EMPTY); - - mFragment.onResume(); - - verify(mContentResolver).registerContentObserver( - eq(Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)), - eq(false), - any(AccessibilitySettingsContentObserver.class)); - verify(mContentResolver).registerContentObserver( - eq(Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE)), - eq(false), - any(AccessibilitySettingsContentObserver.class)); - verify(mContentResolver, never()).registerContentObserver( - eq(Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_QS_TARGETS)), - eq(false), - any(AccessibilitySettingsContentObserver.class)); - } - @Test public void updateShortcutPreferenceData_assignDefaultValueToVariable() { mFragment.mComponentName = PLACEHOLDER_COMPONENT_NAME; @@ -240,15 +212,6 @@ public class ToggleFeaturePreferenceFragmentTest { assertThat(getLatestPopupWindow()).isNull(); } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - @Config(shadows = ShadowFragment.class) - public void onPreferenceToggledOnEnabledService_showTooltipView() { - mFragment.onPreferenceToggled(mFragment.getUseServicePreferenceKey(), /* enabled= */ true); - - assertThat(getLatestPopupWindow().isShowing()).isTrue(); - } - @Test @Config(shadows = ShadowFragment.class) public void onPreferenceToggledOnEnabledService_inSuw_toolTipViewShouldNotShow() { @@ -261,18 +224,6 @@ public class ToggleFeaturePreferenceFragmentTest { assertThat(getLatestPopupWindow()).isNull(); } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - @Config(shadows = ShadowFragment.class) - public void onPreferenceToggledOnEnabledService_tooltipViewShown_notShowTooltipView() { - mFragment.onPreferenceToggled(mFragment.getUseServicePreferenceKey(), /* enabled= */ true); - getLatestPopupWindow().dismiss(); - - mFragment.onPreferenceToggled(mFragment.getUseServicePreferenceKey(), /* enabled= */ true); - - assertThat(getLatestPopupWindow().isShowing()).isFalse(); - } - @Test public void initTopIntroPreference_hasTopIntroTitle_shouldSetAsExpectedValue() { mFragment.mTopIntroTitle = DEFAULT_TOP_INTRO; @@ -365,7 +316,6 @@ public class ToggleFeaturePreferenceFragmentTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) @Config(shadows = ShadowFragment.class) public void showQuickSettingsTooltipIfNeeded_qsFlagOn_dontShowTooltipView() { mFragment.showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_EDIT); @@ -374,7 +324,6 @@ public class ToggleFeaturePreferenceFragmentTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void getShortcutTypeSummary_shortcutSummaryIsCorrectlySet() { final PreferredShortcut userPreferredShortcut = new PreferredShortcut( PLACEHOLDER_COMPONENT_NAME.flattenToString(), diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java index 87632ae8a64..0b385941997 100644 --- a/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java @@ -337,8 +337,7 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onResume_flagEnabled_haveRegisterToSpecificUris() { + public void onResume_haveRegisterToSpecificUris() { ShadowContentResolver shadowContentResolver = Shadows.shadowOf( mContext.getContentResolver()); Uri[] observedUri = new Uri[]{ @@ -367,38 +366,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { } } - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void onResume_flagDisabled_haveRegisterToSpecificUris() { - ShadowContentResolver shadowContentResolver = Shadows.shadowOf( - mContext.getContentResolver()); - Uri[] observedUri = new Uri[]{ - Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS), - Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE), - Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_FOLLOW_TYPING_ENABLED), - Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED) - }; - for (Uri uri : observedUri) { - // verify no observer registered before launching the fragment - assertThat(shadowContentResolver.getContentObservers(uri)).isEmpty(); - } - - mFragController.create(R.id.main_content, /* bundle= */ null).start().resume(); - - for (Uri uri : observedUri) { - Collection observers = shadowContentResolver.getContentObservers(uri); - assertThat(observers.size()).isEqualTo(1); - assertThat(observers.stream().findFirst().get()).isInstanceOf( - AccessibilitySettingsContentObserver.class); - } - assertThat(shadowContentResolver.getContentObservers( - Settings.Secure.getUriFor( - Settings.Secure.ACCESSIBILITY_QS_TARGETS))).hasSize(0); - } - @Test @EnableFlags(Flags.FLAG_ENABLE_MAGNIFICATION_ONE_FINGER_PANNING_GESTURE) public void onResume_oneFingerPanningFlagOn_registerToSpecificUri() { @@ -462,20 +429,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { } @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInAllValuesToSettings_optInValue_haveMatchString() { - int shortcutTypes = SOFTWARE | TRIPLETAP; - - ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext, - shortcutTypes); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - MAGNIFICATION_CONTROLLER_NAME); - assertThat(getMagnificationTripleTapStatus()).isTrue(); - } - - @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void optInAllValuesToSettings_optInValue_callA11yManager() { int shortcutTypes = SOFTWARE | TRIPLETAP | HARDWARE @@ -500,45 +453,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { verifyNoMoreInteractions(mAccessibilityManager); } - @Test - @EnableFlags(Flags.FLAG_ENABLE_MAGNIFICATION_MULTIPLE_FINGER_MULTIPLE_TAP_GESTURE) - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInAllValuesToSettings_twoFingerTripleTap_haveMatchString() { - int shortcutTypes = TWOFINGER_DOUBLETAP; - - ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext, - shortcutTypes); - - assertThat(Settings.Secure.getInt(mContext.getContentResolver(), - TWO_FINGER_TRIPLE_TAP_SHORTCUT_KEY, OFF)).isEqualTo(ON); - } - - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInAllValuesToSettings_existOtherValue_optInValue_haveMatchString() { - putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, PLACEHOLDER_COMPONENT_NAME.flattenToString()); - - ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext, - SOFTWARE); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - PLACEHOLDER_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME); - } - - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optInAllValuesToSettings_software_sizeValueIsNull_putLargeSizeValue() { - ShadowSettings.ShadowSecure.reset(); - - ToggleScreenMagnificationPreferenceFragment.optInAllMagnificationValuesToSettings(mContext, - SOFTWARE); - - assertThat(Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.UNKNOWN)).isEqualTo( - FloatingMenuSizePreferenceController.Size.LARGE); - } - @Test public void optInAllValuesToSettings_software_sizeValueIsNotNull_sizeValueIsNotChanged() { for (int size : new int[]{FloatingMenuSizePreferenceController.Size.LARGE, @@ -594,24 +508,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { } @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutAllValuesToSettings_optOutValue_emptyString() { - putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME); - putStringIntoSettings(HARDWARE_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME); - setMagnificationTripleTapEnabled(/* enabled= */ true); - int shortcutTypes = - SOFTWARE | HARDWARE | TRIPLETAP; - - ToggleScreenMagnificationPreferenceFragment.optOutAllMagnificationValuesFromSettings( - mContext, shortcutTypes); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEmpty(); - assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEmpty(); - assertThat(getMagnificationTripleTapStatus()).isFalse(); - } - - @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void optOutAllValuesToSettings_optOutValue_callA11yManager() { Set shortcutTargets = Set.of(MAGNIFICATION_CONTROLLER_NAME); putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, MAGNIFICATION_CONTROLLER_NAME); @@ -635,38 +531,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { verifyNoMoreInteractions(mAccessibilityManager); } - @Test - @EnableFlags(Flags.FLAG_ENABLE_MAGNIFICATION_MULTIPLE_FINGER_MULTIPLE_TAP_GESTURE) - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutAllValuesToSettings_twoFingerTripleTap_settingsValueIsOff() { - Settings.Secure.putInt(mContext.getContentResolver(), - TWO_FINGER_TRIPLE_TAP_SHORTCUT_KEY, ON); - - ToggleScreenMagnificationPreferenceFragment.optOutAllMagnificationValuesFromSettings( - mContext, TWOFINGER_DOUBLETAP); - - assertThat(Settings.Secure.getInt(mContext.getContentResolver(), - TWO_FINGER_TRIPLE_TAP_SHORTCUT_KEY, ON)).isEqualTo(OFF); - } - - @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void optOutValueFromSettings_existOtherValue_optOutValue_haveMatchString() { - putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, - PLACEHOLDER_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME); - putStringIntoSettings(HARDWARE_SHORTCUT_KEY, - PLACEHOLDER_COMPONENT_NAME.flattenToString() + ":" + MAGNIFICATION_CONTROLLER_NAME); - int shortcutTypes = SOFTWARE | HARDWARE; - - ToggleScreenMagnificationPreferenceFragment.optOutAllMagnificationValuesFromSettings( - mContext, shortcutTypes); - - assertThat(getStringFromSettings(SOFTWARE_SHORTCUT_KEY)).isEqualTo( - PLACEHOLDER_COMPONENT_NAME.flattenToString()); - assertThat(getStringFromSettings(HARDWARE_SHORTCUT_KEY)).isEqualTo( - PLACEHOLDER_COMPONENT_NAME.flattenToString()); - } - @Test public void updateShortcutPreferenceData_assignDefaultValueToVariable() { mFragController.create(R.id.main_content, /* bundle= */ null).start().resume(); @@ -979,7 +843,6 @@ public class ToggleScreenMagnificationPreferenceFragmentTest { } @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void getShortcutTypeSummary_shortcutSummaryIsCorrectlySet() { final PreferredShortcut userPreferredShortcut = new PreferredShortcut( MAGNIFICATION_CONTROLLER_NAME, diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java index b3270e95c11..dd898e39175 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java @@ -46,7 +46,6 @@ import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.util.Pair; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; @@ -466,7 +465,6 @@ public class EditShortcutsPreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void fragmentResumed_enableTouchExploration_qsShortcutOptionSummaryUpdated() { String expectedSummary = StringUtil.getIcuPluralsString(mContext, 2, R.string.accessibility_shortcut_edit_dialog_summary_quick_settings); @@ -486,7 +484,6 @@ public class EditShortcutsPreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void fragmentPaused_enableTouchExploration_qsShortcutOptionSummaryNotUpdated() { String expectedSummary = StringUtil.getIcuPluralsString(mContext, 1, R.string.accessibility_shortcut_edit_dialog_summary_quick_settings); @@ -644,7 +641,6 @@ public class EditShortcutsPreferenceFragmentTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void onQuickSettingsShortcutSettingChanged_preferredShortcutsUpdated() { final String target = TARGET_FAKE_COMPONENT.flattenToString(); mFragmentScenario = createFragScenario( diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionControllerTest.java index 55fbd8e3249..8f26c99be11 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/QuickSettingsShortcutOptionControllerTest.java @@ -27,11 +27,7 @@ import android.accessibilityservice.AccessibilityServiceInfo; import android.content.ComponentName; import android.content.Context; import android.os.UserHandle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; -import android.platform.test.flag.junit.SetFlagsRule; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.preference.PreferenceManager; import androidx.preference.PreferenceScreen; @@ -45,7 +41,6 @@ import com.android.settings.testutils.shadow.SettingsShadowResources; import com.android.settingslib.utils.StringUtil; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -67,8 +62,6 @@ public class QuickSettingsShortcutOptionControllerTest { private static final String TARGET_FLATTEN = TARGET.flattenToString(); private static final ComponentName TARGET_TILE = new ComponentName("FakePackage", "FakeTileClass"); - @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private final Context mContext = spy(ApplicationProvider.getApplicationContext()); private QuickSettingsShortcutOptionController mController; @@ -149,13 +142,6 @@ public class QuickSettingsShortcutOptionControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void isShortcutAvailable_a11yQsShortcutFlagDisabled_returnsFalse() { - assertThat(mController.isShortcutAvailable()).isFalse(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void isShortcutAvailable_qsNotSupported_returnsFalse() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_quickSettingsSupported, false); @@ -164,7 +150,6 @@ public class QuickSettingsShortcutOptionControllerTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void isShortcutAvailable_qsTileProvided_returnsTrue() { when(mAccessibilityManager.getA11yFeatureToTileMap(UserHandle.myUserId())) .thenReturn(Map.of(TARGET, TARGET_TILE)); @@ -173,7 +158,6 @@ public class QuickSettingsShortcutOptionControllerTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void isShortcutAvailable_qsTileNotProvided_returnsFalse() { when(mAccessibilityManager.getA11yFeatureToTileMap(UserHandle.myUserId())) .thenReturn(Collections.emptyMap()); @@ -182,7 +166,6 @@ public class QuickSettingsShortcutOptionControllerTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void isShortcutAvailable_qsTileProvided_invalidUseCase_returnFalse() { AccessibilityServiceInfo mockStandardA11yService = AccessibilityTestUtils.createAccessibilityServiceInfo( @@ -197,7 +180,6 @@ public class QuickSettingsShortcutOptionControllerTest { } @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void isShortcutAvailable_qsTileProvided_validUseCase_returnTrue() { AccessibilityServiceInfo mockAlwaysOnA11yService = AccessibilityTestUtils.createAccessibilityServiceInfo( diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceControllerTest.java index 1eeb9446c21..74e9870522a 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/SoftwareShortcutOptionPreferenceControllerTest.java @@ -33,14 +33,11 @@ import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.os.UserHandle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.text.SpannableStringBuilder; import android.view.View; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.fragment.app.FragmentActivity; @@ -50,10 +47,8 @@ import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.SubSettings; import com.android.settings.accessibility.AccessibilityButtonFragment; -import com.android.settings.accessibility.FloatingMenuSizePreferenceController; import com.android.settings.testutils.AccessibilityTestUtils; import com.android.settings.utils.AnnotationSpan; -import com.android.settingslib.accessibility.AccessibilityUtils; import org.junit.Before; import org.junit.Rule; @@ -178,23 +173,6 @@ public class SoftwareShortcutOptionPreferenceControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableShortcut_shortcutTurnedOn() { - String target = TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString(); - mController.setShortcutTargets(Set.of(target)); - assertThat(ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.SOFTWARE, target - )).isFalse(); - - mController.enableShortcutForTargets(true); - - assertThat(ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.SOFTWARE, target - )).isTrue(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_enableShortcut_callA11yManager() { String target = TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString(); mController.setShortcutTargets(Set.of(target)); @@ -214,25 +192,6 @@ public class SoftwareShortcutOptionPreferenceControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableShortcut_shortcutTurnedOff() { - String target = TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString(); - ShortcutUtils.optInValueToSettings( - mContext, ShortcutConstants.UserShortcutType.SOFTWARE, target); - assertThat(ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.SOFTWARE, target - )).isTrue(); - mController.setShortcutTargets(Set.of(target)); - - mController.enableShortcutForTargets(false); - - assertThat(ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.SOFTWARE, target - )).isFalse(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_disableShortcut_callA11yManager() { String target = TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString(); ShortcutUtils.optInValueToSettings( @@ -253,89 +212,6 @@ public class SoftwareShortcutOptionPreferenceControllerTest { verifyNoMoreInteractions(mAccessibilityManager); } - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableShortcutWithMagnification_menuSizeIncreased() { - mController.setShortcutTargets(Set.of(TARGET_MAGNIFICATION)); - - mController.enableShortcutForTargets(true); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.UNKNOWN)) - .isEqualTo(FloatingMenuSizePreferenceController.Size.LARGE); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableShortcutWithMagnification_userConfigureSmallMenuSize_menuSizeNotChanged() { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.SMALL); - mController.setShortcutTargets(Set.of(TARGET_MAGNIFICATION)); - - mController.enableShortcutForTargets(true); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, - FloatingMenuSizePreferenceController.Size.UNKNOWN)) - .isEqualTo(FloatingMenuSizePreferenceController.Size.SMALL); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableAlwaysOnServiceShortcut_turnsOnAlwaysOnService() { - mController.setShortcutTargets( - Set.of(TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString())); - - mController.enableShortcutForTargets(true); - - assertThat(AccessibilityUtils.getEnabledServicesFromSettings(mContext)) - .contains(TARGET_ALWAYS_ON_A11Y_SERVICE); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableAlwaysOnServiceShortcut_turnsOffAlwaysOnService() { - mController.setShortcutTargets( - Set.of(TARGET_ALWAYS_ON_A11Y_SERVICE.flattenToString())); - - mController.enableShortcutForTargets(false); - - assertThat(AccessibilityUtils.getEnabledServicesFromSettings(mContext)) - .doesNotContain(TARGET_ALWAYS_ON_A11Y_SERVICE); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableStandardServiceShortcut_wontTurnOnService() { - mController.setShortcutTargets( - Set.of(TARGET_STANDARD_A11Y_SERVICE.flattenToString())); - - mController.enableShortcutForTargets(true); - - assertThat(AccessibilityUtils.getEnabledServicesFromSettings(mContext)) - .doesNotContain(TARGET_STANDARD_A11Y_SERVICE); - } - - @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableStandardServiceShortcutWithServiceOn_wontTurnOffService() { - mController.setShortcutTargets( - Set.of(TARGET_STANDARD_A11Y_SERVICE.flattenToString())); - AccessibilityUtils.setAccessibilityServiceState( - mContext, TARGET_STANDARD_A11Y_SERVICE, /* enabled= */ true); - - mController.enableShortcutForTargets(false); - - assertThat(AccessibilityUtils.getEnabledServicesFromSettings(mContext)) - .contains(TARGET_STANDARD_A11Y_SERVICE); - } - private void assertLaunchSettingsPage(String page) { ContextWrapper applicationContext = (Application) mContext.getApplicationContext(); final Intent intent = Shadows.shadowOf(applicationContext).getNextStartedActivity(); diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionControllerTest.java index 1ffd042b172..6526862634f 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/TripleTapShortcutOptionControllerTest.java @@ -28,12 +28,9 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import android.content.ComponentName; import android.content.Context; import android.os.UserHandle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.preference.PreferenceManager; import androidx.preference.PreferenceScreen; @@ -182,20 +179,6 @@ public class TripleTapShortcutOptionControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableShortcut_settingUpdated() { - mController.enableShortcutForTargets(true); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, - AccessibilityUtil.State.OFF) - ).isEqualTo(AccessibilityUtil.State.ON); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_enableShortcut_callA11yManager() { mController.enableShortcutForTargets(true); @@ -209,20 +192,6 @@ public class TripleTapShortcutOptionControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableShortcut_settingUpdated() { - mController.enableShortcutForTargets(false); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, - AccessibilityUtil.State.OFF) - ).isEqualTo(AccessibilityUtil.State.OFF); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_disableShortcut_callA11yManager() { mController.enableShortcutForTargets(false); diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionControllerTest.java index dde60e902fa..53048b00775 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/TwoFingerDoubleTapShortcutOptionControllerTest.java @@ -143,20 +143,6 @@ public class TwoFingerDoubleTapShortcutOptionControllerTest { } @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableShortcut_settingUpdated() { - mController.enableShortcutForTargets(true); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, - AccessibilityUtil.State.OFF) - ).isEqualTo(AccessibilityUtil.State.ON); - } - - @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_enableShortcut_callA11yManager() { mController.enableShortcutForTargets(true); @@ -170,20 +156,6 @@ public class TwoFingerDoubleTapShortcutOptionControllerTest { } @Test - @DisableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableShortcut_settingUpdated() { - mController.enableShortcutForTargets(false); - - assertThat( - Settings.Secure.getInt( - mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_MAGNIFICATION_TWO_FINGER_TRIPLE_TAP_ENABLED, - AccessibilityUtil.State.OFF) - ).isEqualTo(AccessibilityUtil.State.OFF); - } - - @Test - @EnableFlags(android.view.accessibility.Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_disableShortcut_callA11yManager() { mController.enableShortcutForTargets(false); diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionControllerTest.java index 511503aceba..d9eb995d18e 100644 --- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/VolumeKeysShortcutOptionControllerTest.java @@ -25,11 +25,8 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import android.content.ComponentName; import android.content.Context; import android.os.UserHandle; -import android.platform.test.annotations.DisableFlags; -import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.Flags; import androidx.preference.PreferenceManager; import androidx.preference.PreferenceScreen; @@ -111,17 +108,6 @@ public class VolumeKeysShortcutOptionControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_enableVolumeKeysShortcut_shortcutSet() { - mController.enableShortcutForTargets(true); - - assertThat( - ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.HARDWARE, TARGET)).isTrue(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_enableVolumeKeysShortcut_callA11yManager() { mController.enableShortcutForTargets(true); @@ -135,17 +121,6 @@ public class VolumeKeysShortcutOptionControllerTest { } @Test - @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) - public void enableShortcutForTargets_disableVolumeKeysShortcut_shortcutNotSet() { - mController.enableShortcutForTargets(false); - - assertThat( - ShortcutUtils.isComponentIdExistingInSettings( - mContext, ShortcutConstants.UserShortcutType.HARDWARE, TARGET)).isFalse(); - } - - @Test - @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT) public void enableShortcutForTargets_disableVolumeKeysShortcut_callA11yManager() { mController.enableShortcutForTargets(false); diff --git a/tests/unit/src/com/android/settings/accessibility/PreferredShortcutsTest.java b/tests/unit/src/com/android/settings/accessibility/PreferredShortcutsTest.java index d068194cd9c..09c746b732b 100644 --- a/tests/unit/src/com/android/settings/accessibility/PreferredShortcutsTest.java +++ b/tests/unit/src/com/android/settings/accessibility/PreferredShortcutsTest.java @@ -25,12 +25,7 @@ import static com.google.common.truth.Truth.assertThat; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; -import android.platform.test.annotations.RequiresFlagsDisabled; -import android.platform.test.annotations.RequiresFlagsEnabled; -import android.platform.test.flag.junit.CheckFlagsRule; -import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.provider.Settings; -import android.view.accessibility.Flags; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -41,7 +36,6 @@ import com.android.internal.accessibility.util.ShortcutUtils; import org.junit.AfterClass; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -61,8 +55,6 @@ public class PreferredShortcutsTest { CLASS_NAME_2); private static final ContentResolver sContentResolver = ApplicationProvider.getApplicationContext().getContentResolver(); - @Rule - public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); private final Context mContext = ApplicationProvider.getApplicationContext(); @Before @@ -175,7 +167,6 @@ public class PreferredShortcutsTest { } @Test - @RequiresFlagsEnabled(Flags.FLAG_A11Y_QS_SHORTCUT) public void updatePreferredShortcutFromSettings_colorInversionWithQsAndSoftwareShortcut_preferredShortcutsMatches() { String target = COLOR_INVERSION_COMPONENT_NAME.flattenToString(); Settings.Secure.putString(sContentResolver, @@ -192,23 +183,6 @@ public class PreferredShortcutsTest { } - @Test - @RequiresFlagsDisabled(Flags.FLAG_A11Y_QS_SHORTCUT) - public void updatePreferredShortcutFromSettings_colorInversionWithQsAndHardwareShortcut_qsShortcutNotSaved() { - String target = COLOR_INVERSION_COMPONENT_NAME.flattenToString(); - Settings.Secure.putString(sContentResolver, - Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE, target); - Settings.Secure.putString(sContentResolver, - Settings.Secure.ACCESSIBILITY_QS_TARGETS, target); - assertThat(!android.view.accessibility.Flags.a11yQsShortcut()).isTrue(); - - PreferredShortcuts.updatePreferredShortcutsFromSettings(mContext, Set.of(target)); - - int savedPreferredShortcut = PreferredShortcuts.retrieveUserShortcutType( - mContext, target); - assertThat(savedPreferredShortcut).isEqualTo(UserShortcutType.HARDWARE); - } - @Test public void retrieveUserShortcutTypeWithoutDefault_noUserPreferredShortcuts_returnSoftwareShortcut() { String target = COMPONENT_NAME_1.flattenToString(); diff --git a/tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceControllerTest.java index 7229996b2e3..e1c0277c7e9 100644 --- a/tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceControllerTest.java +++ b/tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsPreferenceControllerTest.java @@ -16,8 +16,6 @@ package com.android.settings.accessibility; -import static com.android.internal.accessibility.AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_TILE_SERVICE_COMPONENT_NAME; - import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.doReturn; @@ -26,12 +24,7 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.res.Resources; -import android.platform.test.annotations.RequiresFlagsDisabled; -import android.platform.test.annotations.RequiresFlagsEnabled; -import android.platform.test.flag.junit.CheckFlagsRule; -import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.provider.Settings; -import android.view.accessibility.Flags; import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -40,7 +33,6 @@ import com.android.internal.R; import org.junit.Before; import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -48,8 +40,6 @@ import org.junit.runner.RunWith; public class ReduceBrightColorsPreferenceControllerTest { private static final String PREF_KEY = "rbc_preference"; - @Rule - public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); private Context mContext; private Resources mResources;; private ReduceBrightColorsPreferenceController mController; @@ -98,20 +88,6 @@ public class ReduceBrightColorsPreferenceControllerTest { assertThat(mController.isAvailable()).isFalse(); } - - @Test - @RequiresFlagsDisabled(Flags.FLAG_A11Y_QS_SHORTCUT) - public void getTileComponentName_a11yQsFlagOff_returnComponentName() { - assertThat(mController.getTileComponentName()) - .isEqualTo(REDUCE_BRIGHT_COLORS_TILE_SERVICE_COMPONENT_NAME); - } - - @Test - @RequiresFlagsEnabled(Flags.FLAG_A11Y_QS_SHORTCUT) - public void getTileComponentName_a11yQsFlagOff_returnNull() { - assertThat(mController.getTileComponentName()).isNull(); - } - private int resourceId(String type, String name) { return mContext.getResources().getIdentifier(name, type, mContext.getPackageName()); } From 178befee5e63aca7d0cfc56c822c109af036f71d Mon Sep 17 00:00:00 2001 From: songferngwang Date: Tue, 3 Dec 2024 10:12:02 +0000 Subject: [PATCH 09/23] Skip the notification when the userId is not main Fix: 381585049 Test: atest SimSelectNotificationTest Flag: EXEMPT bugfix Change-Id: I9a08a1c28948051cbf5a316b8cc5c676f25ff8cc --- .../settings/sim/SimSelectNotification.java | 6 ++++++ .../sim/SimSelectNotificationTest.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/com/android/settings/sim/SimSelectNotification.java b/src/com/android/settings/sim/SimSelectNotification.java index 3d9d41cb6bf..44fd43f7d19 100644 --- a/src/com/android/settings/sim/SimSelectNotification.java +++ b/src/com/android/settings/sim/SimSelectNotification.java @@ -42,6 +42,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.res.Resources; +import android.os.UserManager; import android.provider.Settings; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; @@ -91,6 +92,11 @@ public class SimSelectNotification extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + UserManager userManager = context.getSystemService(UserManager.class); + if (userManager != null && !userManager.isMainUser()) { + Log.d(TAG, "The userId is not the main user"); + return; + } if (!SubscriptionUtil.isSimHardwareVisible(context)) { Log.w(TAG, "Received unexpected intent with null action."); return; diff --git a/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java b/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java index 36f6cd4058e..0171dc402f5 100644 --- a/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java +++ b/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java @@ -54,6 +54,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.os.UserManager; import android.provider.Settings; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; @@ -103,6 +104,8 @@ public class SimSelectNotificationTest { private DisplayMetrics mDisplayMetrics; @Mock private SimDialogActivity mActivity; + @Mock + private UserManager mUserManager; private final String mFakeDisplayName = "fake_display_name"; private final CharSequence mFakeNotificationChannelTitle = "fake_notification_channel_title"; @@ -128,6 +131,8 @@ public class SimSelectNotificationTest { .thenReturn(mNotificationManager); when(mContext.getSystemService(Context.TELEPHONY_SERVICE)) .thenReturn(mTelephonyManager); + when(mContext.getSystemService(UserManager.class)) + .thenReturn(mUserManager); when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager); when(mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)) .thenReturn(mSubscriptionManager); @@ -135,6 +140,7 @@ public class SimSelectNotificationTest { when(mContext.getPackageManager()).thenReturn(mPackageManager); when(mPackageManager.checkPermission(any(), any())) .thenReturn(PackageManager.PERMISSION_GRANTED); + when(mUserManager.isMainUser()).thenReturn(true); when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager); when(mTelephonyManager.isDataEnabledForApn(TYPE_MMS)).thenReturn(false); @@ -217,6 +223,18 @@ public class SimSelectNotificationTest { verify(mNotificationManager, never()).createNotificationChannel(any()); } + @Test + public void onReceivePrimarySubListChange_userIdIsNotMain_notificationShouldNotSend() { + when(mUserManager.isMainUser()).thenReturn(false); + Intent intent = new Intent(TelephonyManager.ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED); + intent.putExtra(EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE, + EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA); + + // If MMS data is already enabled, there's no need to trigger the notification. + mSimSelectNotification.onReceive(mContext, intent); + verify(mNotificationManager, never()).createNotificationChannel(any()); + } + @Test public void onReceivePrimarySubListChange_NoExtra_notificationShouldNotSend() { Intent intent = new Intent(TelephonyManager.ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED); From f2d4490fa874fb030604dbdcca52e965be596f01 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Tue, 3 Dec 2024 20:25:38 +0800 Subject: [PATCH 10/23] [Catalyst] Refine WifiSwitchPreference NO_IFTTT=Catalyst only Bug: 372733639 Flag: com.android.settings.flags.catalyst_internet_settings Test: devtool Change-Id: I3e46ea61135e37bab89cbdbeb04d1f1938593a89 --- .../settings/wifi/WifiSwitchPreference.kt | 142 +++++++++++------- 1 file changed, 88 insertions(+), 54 deletions(-) diff --git a/src/com/android/settings/wifi/WifiSwitchPreference.kt b/src/com/android/settings/wifi/WifiSwitchPreference.kt index 72bee592d52..2a18d3f5616 100644 --- a/src/com/android/settings/wifi/WifiSwitchPreference.kt +++ b/src/com/android/settings/wifi/WifiSwitchPreference.kt @@ -16,22 +16,31 @@ package com.android.settings.wifi +import android.content.BroadcastReceiver import android.content.Context +import android.content.Intent +import android.content.IntentFilter import android.net.wifi.WifiManager import android.os.UserManager import android.provider.Settings import android.util.Log +import android.widget.Toast import androidx.preference.Preference +import androidx.preference.Preference.OnPreferenceChangeListener import com.android.settings.PreferenceRestrictionMixin import com.android.settings.R import com.android.settings.network.SatelliteRepository -import com.android.settings.overlay.FeatureFactory.Companion.featureFactory -import com.android.settings.widget.GenericSwitchController +import com.android.settings.network.SatelliteWarningDialogActivity import com.android.settingslib.RestrictedSwitchPreference import com.android.settingslib.WirelessUtils +import com.android.settingslib.datastore.AbstractKeyedDataObservable +import com.android.settingslib.datastore.DataChangeReason import com.android.settingslib.datastore.KeyValueStore -import com.android.settingslib.datastore.NoOpKeyedObservable -import com.android.settingslib.metadata.* +import com.android.settingslib.metadata.PreferenceLifecycleProvider +import com.android.settingslib.metadata.PreferenceMetadata +import com.android.settingslib.metadata.ReadWritePermit +import com.android.settingslib.metadata.SensitivityLevel +import com.android.settingslib.metadata.SwitchPreference import com.android.settingslib.preference.SwitchPreferenceBinding import java.util.concurrent.Executors import java.util.concurrent.TimeUnit @@ -40,12 +49,10 @@ import java.util.concurrent.TimeUnit class WifiSwitchPreference : SwitchPreference(KEY, R.string.wifi), SwitchPreferenceBinding, + OnPreferenceChangeListener, PreferenceLifecycleProvider, PreferenceRestrictionMixin { - // TODO(b/372733639) Remove WifiEnabler and migrate to catalyst - private var wifiEnabler: WifiEnabler? = null - override val keywords: Int get() = R.string.keywords_wifi @@ -57,21 +64,57 @@ class WifiSwitchPreference : override val useAdminDisabledSummary: Boolean get() = true + override fun createWidget(context: Context) = RestrictedSwitchPreference(context) + + override fun bind(preference: Preference, metadata: PreferenceMetadata) { + super.bind(preference, metadata) + preference.onPreferenceChangeListener = this + } + + override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean { + val context = preference.context + + // Show dialog and do nothing under satellite mode. + if (context.isSatelliteOn()) { + context.startActivity( + Intent(context, SatelliteWarningDialogActivity::class.java) + .putExtra( + SatelliteWarningDialogActivity.EXTRA_TYPE_OF_SATELLITE_WARNING_DIALOG, + SatelliteWarningDialogActivity.TYPE_IS_WIFI, + ) + ) + return false + } + + // Show toast message if Wi-Fi is not allowed in airplane mode + if (newValue == true && !context.isRadioAllowed()) { + Toast.makeText(context, R.string.wifi_in_airplane_mode, Toast.LENGTH_SHORT).show() + return false + } + + return true + } + override fun getReadPermit(context: Context, myUid: Int, callingUid: Int) = ReadWritePermit.ALLOW override fun getWritePermit(context: Context, value: Boolean?, myUid: Int, callingUid: Int) = when { - isRadioAllowed(context, value) && !isSatelliteOn(context) -> ReadWritePermit.ALLOW - else -> ReadWritePermit.DISALLOW + (value == true && !context.isRadioAllowed()) || context.isSatelliteOn() -> + ReadWritePermit.DISALLOW + else -> ReadWritePermit.ALLOW } + override val sensitivityLevel + get() = SensitivityLevel.LOW_SENSITIVITY + override fun storage(context: Context): KeyValueStore = WifiSwitchStore(context) @Suppress("UNCHECKED_CAST") private class WifiSwitchStore(private val context: Context) : - NoOpKeyedObservable(), - KeyValueStore { + AbstractKeyedDataObservable(), KeyValueStore { + + private var broadcastReceiver: BroadcastReceiver? = null override fun contains(key: String) = key == KEY && context.getSystemService(WifiManager::class.java) != null @@ -85,60 +128,51 @@ class WifiSwitchPreference : context.getSystemService(WifiManager::class.java)?.isWifiEnabled = value } } - } - override fun onCreate(context: PreferenceLifecycleContext) { - context.requirePreference(KEY).let { - it.onPreferenceChangeListener = - Preference.OnPreferenceChangeListener { _: Preference, newValue: Any -> - if (!isRadioAllowed(context, newValue as Boolean?)) { - Log.w(TAG, "Don't set APM, AIRPLANE_MODE_RADIOS is not allowed") - return@OnPreferenceChangeListener false + override fun onFirstObserverAdded() { + broadcastReceiver = + object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + val wifiState = intent.wifiState + // do not notify for enabling/disabling state + if ( + wifiState == WifiManager.WIFI_STATE_ENABLED || + wifiState == WifiManager.WIFI_STATE_DISABLED + ) { + notifyChange(KEY, DataChangeReason.UPDATE) + } } - if (isSatelliteOn(context)) { - Log.w(TAG, "Don't set APM, the satellite is on") - return@OnPreferenceChangeListener false - } - return@OnPreferenceChangeListener true } - val widget = GenericSwitchController(it) - wifiEnabler = WifiEnabler(context, widget, featureFactory.metricsFeatureProvider) - Log.i(TAG, "Create WifiEnabler:$wifiEnabler") + context.registerReceiver( + broadcastReceiver, + IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION), + ) } - } - override fun onResume(context: PreferenceLifecycleContext) { - wifiEnabler?.resume(context) - } - - override fun onPause(context: PreferenceLifecycleContext) { - wifiEnabler?.pause() - } - - override fun onDestroy(context: PreferenceLifecycleContext) { - wifiEnabler?.teardownSwitchController() - wifiEnabler = null - } - - private fun isRadioAllowed(context: Context, newValue: Boolean?): Boolean { - newValue?.let { if (!it) return true } ?: return false - return WirelessUtils.isRadioAllowed(context, Settings.Global.RADIO_WIFI) - } - - private fun isSatelliteOn(context: Context): Boolean { - try { - return SatelliteRepository(context) - .requestIsSessionStarted(Executors.newSingleThreadExecutor()) - .get(2000, TimeUnit.MILLISECONDS) - } catch (e: Exception) { - Log.e(TAG, "Error to get satellite status : $e") + override fun onLastObserverRemoved() { + broadcastReceiver?.let { context.unregisterReceiver(it) } } - return false } companion object { const val TAG = "WifiSwitchPreference" const val KEY = "main_toggle_wifi" + + private fun Context.isRadioAllowed() = + WirelessUtils.isRadioAllowed(this, Settings.Global.RADIO_WIFI) + + private fun Context.isSatelliteOn() = + try { + SatelliteRepository(this) + .requestIsSessionStarted(Executors.newSingleThreadExecutor()) + .get(2000, TimeUnit.MILLISECONDS) + } catch (e: Exception) { + Log.e(TAG, "Error to get satellite status : $e") + false + } + + private val Intent.wifiState + get() = getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN) } } // LINT.ThenChange(WifiSwitchPreferenceController.java) From 5d2ddfc6dd628eea86a1bfec3a30146fdabd7c8b Mon Sep 17 00:00:00 2001 From: Matthew DeVore Date: Wed, 27 Nov 2024 03:59:43 +0000 Subject: [PATCH 11/23] TopologyScale values for scaling the topology pane TopologyScale helps to size the topology pane and properly size and place the display blocks inside it. It is based on the algorithm described in the design doc. Test: TopologyScaleTest Flag: com.android.settings.flags.display_topology_pane_in_display_list Bug: b/352648432 Change-Id: I8932e80c2b490fab0097fa315e536b292376d4a8 --- .../display/DisplayTopology.kt | 99 +++++++++++++++++++ .../display/TopologyScaleTest.kt | 79 +++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt diff --git a/src/com/android/settings/connecteddevice/display/DisplayTopology.kt b/src/com/android/settings/connecteddevice/display/DisplayTopology.kt index 81559027837..d483f4624d7 100644 --- a/src/com/android/settings/connecteddevice/display/DisplayTopology.kt +++ b/src/com/android/settings/connecteddevice/display/DisplayTopology.kt @@ -19,9 +19,108 @@ package com.android.settings.connecteddevice.display import com.android.settings.R import android.content.Context +import android.graphics.Point +import android.graphics.PointF +import android.graphics.RectF import androidx.preference.Preference +import java.util.Locale + +import kotlin.math.max +import kotlin.math.min + +/** + * Contains the parameters needed for transforming global display coordinates to and from topology + * pane coordinates. This is necessary for implementing an interactive display topology pane. The + * pane allows dragging and dropping display blocks into place to define the topology. Conversion to + * pane coordinates is necessary when rendering the original topology. Conversion in the other + * direction, to display coordinates, is necessary for resolve a drag position to display space. + * + * The topology pane coordinates are integral and represent the relative position from the upper- + * left corner of the pane. It uses a scale optimized for showing all displays with minimal or no + * scrolling. The display coordinates are floating point and the origin can be in any position. In + * practice the origin will be the upper-left coordinate of the primary display. + */ +class TopologyScale(paneWidth : Int, displaysPos : Collection) { + /** Scale of block sizes to real-world display sizes. Should be less than 1. */ + val blockRatio : Float + + /** Height of topology pane needed to allow all display blocks to appear with some padding. */ + val paneHeight : Int + + /** Pane's X view coordinate that corresponds with topology's X=0 coordinate. */ + val originPaneX : Int + + /** Pane's Y view coordinate that corresponds with topology's Y=0 coordinate. */ + val originPaneY : Int + + init { + val displayBounds = RectF( + Float.MAX_VALUE, Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE) + var smallestDisplayDim = Float.MAX_VALUE + + // displayBounds is the smallest rect encompassing all displays, in display space. + // smallestDisplayDim is the size of the smallest display edge, in display space. + for (pos in displaysPos) { + displayBounds.union(pos) + smallestDisplayDim = minOf(smallestDisplayDim, pos.height(), pos.width()) + } + + // Set height according to the width and the aspect ratio of the display bounds. + // 0.05 is a reasonable limit to the size of display blocks. It appears to match the + // ratio used in the ChromeOS topology editor. It prevents blocks from being too large, + // which would make dragging and dropping awkward. + val rawBlockRatio = min(0.05, paneWidth.toDouble() * 0.6 / displayBounds.width()) + + // If the `ratio` is set too low because one of the displays will have an edge less than + // 48dp long, increase it such that the smallest edge is that long. This may override the + // 0.05 limit since it is more important than it. + blockRatio = max(48.0 / smallestDisplayDim, rawBlockRatio).toFloat() + + // Essentially, we just set the pane height based on the pre-determined pane width and the + // aspect ratio of the display bounds. But we may need to increase it slightly to achieve + // 20% padding above and below the display bounds - this is where the 0.6 comes from. + paneHeight = max( + paneWidth.toDouble() / displayBounds.width() * displayBounds.height(), + displayBounds.height() * blockRatio / 0.6).toInt() + + // Set originPaneXY (the location of 0,0 in display space in the pane's coordinate system) + // such that the display bounds rect is centered in the pane. + // It is unlikely that either of these coordinates will be negative since blockRatio has + // been chosen to allow 20% padding around each side of the display blocks. However, the + // a11y requirement applied above (48.0 / smallestDisplayDim) may cause the blocks to not + // fit. This should be rare in practice, and can be worked around by moving the settings UI + // to a larger display. + val blockMostLeft = (paneWidth - displayBounds.width() * blockRatio) / 2 + val blockMostTop = (paneHeight - displayBounds.height() * blockRatio) / 2 + + originPaneX = (blockMostLeft - displayBounds.left * blockRatio).toInt() + originPaneY = (blockMostTop - displayBounds.top * blockRatio).toInt() + } + + /** Transforms coordinates in view pane space to display space. */ + fun paneToDisplayCoor(panePos : Point) : PointF { + return PointF( + (panePos.x - originPaneX).toFloat() / blockRatio, + (panePos.y - originPaneY).toFloat() / blockRatio) + } + + /** Transforms coordinates in display space to view pane space. */ + fun displayToPaneCoor(displayPos : PointF) : Point { + return Point( + (displayPos.x * blockRatio).toInt() + originPaneX, + (displayPos.y * blockRatio).toInt() + originPaneY) + } + + override fun toString() : String { + return String.format( + Locale.ROOT, + "{TopoScale blockRatio=%f originPaneXY=%d,%d paneHeight=%d}", + blockRatio, originPaneX, originPaneY, paneHeight) + } +} + const val PREFERENCE_KEY = "display_topology_preference" /** diff --git a/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt b/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt new file mode 100644 index 00000000000..e02cd40650c --- /dev/null +++ b/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.connecteddevice.display + +import android.graphics.Point +import android.graphics.PointF +import android.graphics.RectF +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner + +fun assertPointF(x: Float, y: Float, delta: Float, actual: PointF) { + assertEquals(x, actual.x, delta) + assertEquals(y, actual.y, delta) +} + +@RunWith(RobolectricTestRunner::class) +class TopologyScaleTest { + @Test + fun oneDisplay4to3Aspect() { + val scale = TopologyScale( + /* paneWidth= */ 640, + listOf(RectF(0f, 0f, 640f, 480f))) + + // blockRatio is higher than 0.05 in order to make the smallest display edge (480 dp) 48dp + // in the pane. + assertEquals( + "{TopoScale blockRatio=0.100000 originPaneXY=288,216 paneHeight=480}", "" + scale) + + assertEquals(Point(352, 264), scale.displayToPaneCoor(PointF(640f, 480f))) + assertEquals(Point(320, 240), scale.displayToPaneCoor(PointF(320f, 240f))) + assertEquals(PointF(640f, 480f), scale.paneToDisplayCoor(Point(352, 264))) + } + + @Test + fun twoUnalignedDisplays() { + val scale = TopologyScale( + /* paneWidth= */ 300, + listOf(RectF(0f, 0f, 1920f, 1200f), RectF(1920f, -300f, 3840f, 900f))) + + assertEquals( + "{TopoScale blockRatio=0.046875 originPaneXY=60,37 paneHeight=117}", "" + scale) + + assertEquals(Point(78, 55), scale.displayToPaneCoor(PointF(400f, 400f))) + assertEquals(Point(42, 37), scale.displayToPaneCoor(PointF(-400f, 0f))) + assertPointF(-384f, 106.6666f, 0.001f, scale.paneToDisplayCoor(Point(42, 42))) + } + + @Test + fun twoDisplaysBlockRatioBumpedForGarSizeMinimumHorizontal() { + val scale = TopologyScale( + /* paneWidth= */ 192, + listOf(RectF(0f, 0f, 240f, 320f), RectF(-240f, -320f, 0f, 0f))) + + // blockRatio is higher than 0.05 in order to make the smallest display edge (240 dp) 48dp + // in the pane. + assertEquals( + "{TopoScale blockRatio=0.200000 originPaneXY=96,128 paneHeight=256}", "" + scale) + + assertEquals(Point(192, 256), scale.displayToPaneCoor(PointF(480f, 640f))) + assertEquals(Point(96, 64), scale.displayToPaneCoor(PointF(0f, -320f))) + assertPointF(220f, -430f, 0.001f, scale.paneToDisplayCoor(Point(140, 42))) + } +} From 607b01760f0fff1099dc99c68c67656cd3a2cfdc Mon Sep 17 00:00:00 2001 From: Matthew DeVore Date: Tue, 3 Dec 2024 20:05:54 +0000 Subject: [PATCH 12/23] TopologyScale: limit vertical padding In the original design, we don't allow the vertical padding to be more than the tallest display block on the top or bottom. This patch simply applies that strategy that was in the design. Test: TopologyScaleTest Bug: b/352648432 Flag: com.android.settings.flags.display_topology_pane_in_display_list Change-Id: Icd3e0c93e4201d8251de0be4ca636352115c657d --- .../display/DisplayTopology.kt | 14 ++++++++-- .../display/TopologyScaleTest.kt | 26 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/com/android/settings/connecteddevice/display/DisplayTopology.kt b/src/com/android/settings/connecteddevice/display/DisplayTopology.kt index d483f4624d7..162d9d284fb 100644 --- a/src/com/android/settings/connecteddevice/display/DisplayTopology.kt +++ b/src/com/android/settings/connecteddevice/display/DisplayTopology.kt @@ -59,12 +59,14 @@ class TopologyScale(paneWidth : Int, displaysPos : Collection) { val displayBounds = RectF( Float.MAX_VALUE, Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE) var smallestDisplayDim = Float.MAX_VALUE + var biggestDisplayHeight = Float.MIN_VALUE // displayBounds is the smallest rect encompassing all displays, in display space. // smallestDisplayDim is the size of the smallest display edge, in display space. for (pos in displaysPos) { displayBounds.union(pos) smallestDisplayDim = minOf(smallestDisplayDim, pos.height(), pos.width()) + biggestDisplayHeight = max(biggestDisplayHeight, pos.height()) } // Set height according to the width and the aspect ratio of the display bounds. @@ -81,9 +83,17 @@ class TopologyScale(paneWidth : Int, displaysPos : Collection) { // Essentially, we just set the pane height based on the pre-determined pane width and the // aspect ratio of the display bounds. But we may need to increase it slightly to achieve // 20% padding above and below the display bounds - this is where the 0.6 comes from. - paneHeight = max( + val rawPaneHeight = max( paneWidth.toDouble() / displayBounds.width() * displayBounds.height(), - displayBounds.height() * blockRatio / 0.6).toInt() + displayBounds.height() * blockRatio / 0.6) + + // It is easy for the aspect ratio to result in an excessively tall pane, since the width is + // pre-determined and may be considerably wider than necessary. So we prevent the height + // from growing too large here, by limiting vertical padding to the size of the tallest + // display. This improves results for very tall display bounds. + paneHeight = min( + rawPaneHeight.toInt(), + (blockRatio * (displayBounds.height() + biggestDisplayHeight * 2f)).toInt()) // Set originPaneXY (the location of 0,0 in display space in the pane's coordinate system) // such that the display bounds rect is centered in the pane. diff --git a/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt b/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt index e02cd40650c..078436264e7 100644 --- a/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt +++ b/tests/robotests/src/com/android/settings/connecteddevice/display/TopologyScaleTest.kt @@ -40,11 +40,11 @@ class TopologyScaleTest { // blockRatio is higher than 0.05 in order to make the smallest display edge (480 dp) 48dp // in the pane. assertEquals( - "{TopoScale blockRatio=0.100000 originPaneXY=288,216 paneHeight=480}", "" + scale) + "{TopoScale blockRatio=0.100000 originPaneXY=288,48 paneHeight=144}", "" + scale) - assertEquals(Point(352, 264), scale.displayToPaneCoor(PointF(640f, 480f))) - assertEquals(Point(320, 240), scale.displayToPaneCoor(PointF(320f, 240f))) - assertEquals(PointF(640f, 480f), scale.paneToDisplayCoor(Point(352, 264))) + assertEquals(Point(352, 96), scale.displayToPaneCoor(PointF(640f, 480f))) + assertEquals(Point(320, 72), scale.displayToPaneCoor(PointF(320f, 240f))) + assertEquals(PointF(640f, 480f), scale.paneToDisplayCoor(Point(352, 96))) } @Test @@ -76,4 +76,22 @@ class TopologyScaleTest { assertEquals(Point(96, 64), scale.displayToPaneCoor(PointF(0f, -320f))) assertPointF(220f, -430f, 0.001f, scale.paneToDisplayCoor(Point(140, 42))) } + + @Test + fun paneVerticalPaddingLimitedByTallestDisplay() { + val scale = TopologyScale( + /* paneWidth= */ 300, + listOf( + RectF(0f, 0f, 640f, 480f), + RectF(0f, 480f, 640f, 960f), + RectF(0f, 960f, 640f, 1440f), + RectF(0f, 1440f, 640f, 1920f), + RectF(0f, 1920f, 640f, 2400f), + RectF(0f, 2400f, 640f, 2880f))) + + assertEquals( + "{TopoScale blockRatio=0.100000 originPaneXY=118,48 paneHeight=384}", "" + scale) + assertEquals(Point(150, 48), scale.displayToPaneCoor(PointF(320f, 0f))) + assertPointF(-180f, 2880f, 0.001f, scale.paneToDisplayCoor(Point(100, 336))) + } } From c09909489f9b9bee442e1c311934b26d84e61fbe Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 8 Nov 2024 19:34:03 +0000 Subject: [PATCH 13/23] Create DoubleTapPowerSettingsUtils Create Utils class to store common methods used by Preference controllers Android Settings Feature Request: b/380287172 Bug: 378130789 Test: atest DoubleTapPowerSettingsUtilsTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I0bd47579bd3c8163e2e48ac572577c72f2aab785 --- .../gestures/DoubleTapPowerSettingsUtils.java | 149 +++++++++++++ .../DoubleTapPowerSettingsUtilsTest.java | 203 ++++++++++++++++++ 2 files changed, 352 insertions(+) create mode 100644 src/com/android/settings/gestures/DoubleTapPowerSettingsUtils.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsUtilsTest.java diff --git a/src/com/android/settings/gestures/DoubleTapPowerSettingsUtils.java b/src/com/android/settings/gestures/DoubleTapPowerSettingsUtils.java new file mode 100644 index 00000000000..a1bf9cbd48c --- /dev/null +++ b/src/com/android/settings/gestures/DoubleTapPowerSettingsUtils.java @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2016 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. + */ + +package com.android.settings.gestures; + +import android.content.ContentResolver; +import android.content.Context; +import android.database.ContentObserver; +import android.net.Uri; +import android.provider.Settings; + +import androidx.annotation.NonNull; + +import com.android.internal.R; + +/** Common code for double tap power settings shared between controllers. */ +final class DoubleTapPowerSettingsUtils { + + /** Setting storing whether the double tap power button gesture is enabled. */ + private static final String DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED = + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED; + + static final Uri DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI = + Settings.Secure.getUriFor(DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED); + + /** Setting storing the target action of the double tap power button gesture. */ + private static final String DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION = + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE; + + static final Uri DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION_URI = + Settings.Secure.getUriFor(DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION); + + private static final int DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE = 0; + private static final int DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE = 1; + + static final int ON = 1; + static final int OFF = 0; + + /** + * @return true if double tap power button gesture is available. + */ + public static boolean isDoubleTapPowerButtonGestureAvailable(@NonNull Context context) { + return context.getResources().getBoolean(R.bool.config_doubleTapPowerGestureEnabled); + } + + /** + * Gets double tap power button gesture enable or disable flag from Settings provider. + * + * @return true if double tap on the power button gesture is currently enabled. + * @param context App context + */ + public static boolean isDoubleTapPowerButtonGestureEnabled(@NonNull Context context) { + return Settings.Secure.getInt( + context.getContentResolver(), DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, ON) + == ON; + } + + /** + * Sets double tap power button gesture enable or disable flag to Settings provider. + * + * @param context App context + * @param enable enable or disable double tap power button gesture. + * @return {@code true} if the setting is updated. + */ + public static boolean setDoubleTapPowerButtonGestureEnabled( + @NonNull Context context, boolean enable) { + return Settings.Secure.putInt( + context.getContentResolver(), + DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, + enable ? ON : OFF); + } + + /** + * @return true if double tap on the power button gesture for camera launch is currently + * enabled. + * @param context App context + */ + public static boolean isDoubleTapPowerButtonGestureForCameraLaunchEnabled( + @NonNull Context context) { + return Settings.Secure.getInt( + context.getContentResolver(), + DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION, + context.getResources() + .getInteger( + com.android.internal.R.integer + .config_defaultDoubleTapPowerGestureAction)) + == DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE; + } + + /** + * Sets double tap power button gesture behavior to launch the camera. + * + * @param context App context + * @return {@code true} if the setting is updated. + */ + public static boolean setDoubleTapPowerButtonForCameraLaunch(@NonNull Context context) { + return Settings.Secure.putInt( + context.getContentResolver(), + DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION, + DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE); + } + + /** + * Sets double tap power button gesture behavior to launch the wallet. + * + * @param context App context + * @return {@code true} if the setting is updated. + */ + public static boolean setDoubleTapPowerButtonForWalletLaunch(@NonNull Context context) { + return Settings.Secure.putInt( + context.getContentResolver(), + DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION, + DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE); + } + + /** + * Registers observer for settings state. + * + * @param observer Settings Content Observer + */ + public static void registerObserver( + @NonNull Context context, @NonNull ContentObserver observer) { + final ContentResolver resolver = context.getContentResolver(); + resolver.registerContentObserver( + DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI, true, observer); + resolver.registerContentObserver( + DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION_URI, true, observer); + } + + /** Unregisters observer. */ + public static void unregisterObserver( + @NonNull Context context, @NonNull ContentObserver observer) { + final ContentResolver resolver = context.getContentResolver(); + resolver.unregisterContentObserver(observer); + } +} diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsUtilsTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsUtilsTest.java new file mode 100644 index 00000000000..817f198a5b2 --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsUtilsTest.java @@ -0,0 +1,203 @@ +/* + * 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. + */ + +package com.android.settings.gestures; + +import static com.android.settings.gestures.DoubleTapPowerSettingsUtils.OFF; +import static com.android.settings.gestures.DoubleTapPowerSettingsUtils.ON; + +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; + +import android.content.Context; +import android.content.res.Resources; +import android.provider.Settings; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.internal.R; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class DoubleTapPowerSettingsUtilsTest { + + private static final int DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE = 0; + private static final int DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE = 1; + + private Context mContext; + private Resources mResources; + + @Before + public void setUp() { + mContext = spy(ApplicationProvider.getApplicationContext()); + mResources = mock(Resources.class); + when(mContext.getResources()).thenReturn(mResources); + } + + @Test + public void isDoubleTapPowerButtonGestureAvailable_setAvailable_returnsTrue() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(mContext)) + .isTrue(); + } + + @Test + public void isDoubleTapPowerButtonGestureAvailable_setUnavailable_returnsFalse() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(false); + + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(mContext)) + .isFalse(); + } + + @Test + public void isDoubleTapPowerButtonGestureEnabled_setEnabled_returnsTrue() { + Settings.Secure.putInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, + ON); + + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) + .isTrue(); + } + + @Test + public void isDoubleTapPowerButtonGestureEnabled_setDisabled_returnsFalse() { + Settings.Secure.putInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, + OFF); + + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) + .isFalse(); + } + + @Test + public void isDoubleTapPowerButtonGestureEnabled_valueNotSet_returnsTrue() { + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) + .isTrue(); + } + + @Test + public void setDoubleTapPowerButtonGestureEnabled_setEnabled_returnsEnabled() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, true); + + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, + OFF)) + .isEqualTo(ON); + } + + @Test + public void setDoubleTapPowerButtonGestureEnabled_setDisabled_returnsDisabled() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, false); + + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, + ON)) + .isEqualTo(OFF); + } + + @Test + public void isDoubleTapPowerButtonGestureForCameraLaunchEnabled_valueSetToCamera_returnsTrue() { + Settings.Secure.putInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE, + DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE); + + assertThat( + DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)) + .isTrue(); + } + + @Test + public void + isDoubleTapPowerButtonGestureForCameraLaunchEnabled_valueNotSetToCamera_returnsFalse() { + Settings.Secure.putInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE, + DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE); + + assertThat( + DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)) + .isFalse(); + } + + @Test + public void + isDoubleTapPowerButtonGestureForCameraLaunchEnabled_defaultSetToCamera_returnsTrue() { + when(mResources.getInteger(R.integer.config_defaultDoubleTapPowerGestureAction)) + .thenReturn(DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE); + + assertThat( + DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)) + .isTrue(); + } + + @Test + public void + isDoubleTapPowerButtonGestureForCameraLaunchEnabled_defaultNotCamera_returnsFalse() { + when(mResources.getInteger(R.integer.config_defaultDoubleTapPowerGestureAction)) + .thenReturn(DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE); + + assertThat( + DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)) + .isFalse(); + } + + @Test + public void setDoubleTapPowerButtonForCameraLaunch_setGestureBehaviorToCameraLaunch() { + boolean result = + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForCameraLaunch(mContext); + + assertThat(result).isTrue(); + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE, + DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE)) + .isEqualTo(DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE); + } + + @Test + public void setDoubleTapPowerButtonForWalletLaunch_setGestureBehaviorToWalletLaunch() { + boolean result = + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForWalletLaunch(mContext); + + assertThat(result).isTrue(); + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE, + DOUBLE_TAP_POWER_BUTTON_CAMERA_LAUNCH_VALUE)) + .isEqualTo(DOUBLE_TAP_POWER_BUTTON_WALLET_LAUNCH_VALUE); + } +} From 260f37f849a31b1e7cc4f313afb8945a40f6d9ed Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 15 Nov 2024 18:45:40 +0000 Subject: [PATCH 14/23] Create Double Tap Power Gesture Main Switch Preference Controller Create Preference controller for main switch to enable/disable double tap power gesture Android Settings Feature Request: b/380287172 Bug: 378131071 Test: atest DoubleTapPowerMainSwitchPreferenceControllerTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I6205805768d917521b7d9c8ff074678ef5c36a46 --- ...apPowerMainSwitchPreferenceController.java | 92 +++++++++++++++++ ...werMainSwitchPreferenceControllerTest.java | 98 +++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceControllerTest.java diff --git a/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceController.java new file mode 100644 index 00000000000..3eb18eb931d --- /dev/null +++ b/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceController.java @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +import static com.android.settings.gestures.DoubleTapPowerSettingsUtils.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI; + +import android.content.ContentResolver; +import android.content.Context; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; +import android.os.Looper; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.android.settings.R; +import com.android.settings.widget.SettingsMainSwitchPreferenceController; +import com.android.settingslib.core.lifecycle.LifecycleObserver; +import com.android.settingslib.core.lifecycle.events.OnStart; +import com.android.settingslib.core.lifecycle.events.OnStop; + +/** The controller to handle double tap power button main switch enable or disable state. */ +public class DoubleTapPowerMainSwitchPreferenceController + extends SettingsMainSwitchPreferenceController + implements LifecycleObserver, OnStart, OnStop { + + private final ContentObserver mSettingsObserver = + new ContentObserver(new Handler(Looper.getMainLooper())) { + @Override + public void onChange(boolean selfChange, @Nullable Uri uri) { + if (mSwitchPreference == null || uri == null) { + return; + } + updateState(mSwitchPreference); + } + }; + + public DoubleTapPowerMainSwitchPreferenceController( + @NonNull Context context, @NonNull String preferenceKey) { + super(context, preferenceKey); + } + + @Override + public int getAvailabilityStatus() { + return DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(mContext) + ? AVAILABLE + : UNSUPPORTED_ON_DEVICE; + } + + @Override + public boolean isChecked() { + return DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext); + } + + @Override + public boolean setChecked(boolean isChecked) { + return DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled( + mContext, isChecked); + } + + @Override + public void onStart() { + final ContentResolver resolver = mContext.getContentResolver(); + resolver.registerContentObserver( + DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI, true, mSettingsObserver); + } + + @Override + public void onStop() { + DoubleTapPowerSettingsUtils.unregisterObserver(mContext, mSettingsObserver); + } + + @Override + public int getSliceHighlightMenuRes() { + return R.string.menu_key_system; + } +} diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceControllerTest.java new file mode 100644 index 00000000000..502e52ec6c3 --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerMainSwitchPreferenceControllerTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +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; + +import android.content.Context; +import android.content.res.Resources; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.internal.R; +import com.android.settings.core.BasePreferenceController; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class DoubleTapPowerMainSwitchPreferenceControllerTest { + + private static final String KEY = "gesture_double_tap_power_enabled_main_switch"; + + private Context mContext; + private Resources mResources; + private DoubleTapPowerMainSwitchPreferenceController mController; + + @Before + public void setUp() { + mContext = spy(ApplicationProvider.getApplicationContext()); + mResources = mock(Resources.class); + when(mContext.getResources()).thenReturn(mResources); + mController = new DoubleTapPowerMainSwitchPreferenceController(mContext, KEY); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureAvailable_preferenceEnabled() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.AVAILABLE); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureUnavailable_preferenceUnsupported() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE); + } + + @Test + public void isChecked_setDoubleTapPowerGestureEnabled_mainSwitchChecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, true); + + assertThat(mController.isChecked()).isTrue(); + } + + @Test + public void isChecked_setDoubleTapPowerGestureDisabled_mainSwitchUnchecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, false); + + assertThat(mController.isChecked()).isFalse(); + } + + @Test + public void setChecked_checkMainSwitch_doubleTapPowerGestureEnabled() { + mController.setChecked(true); + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) + .isTrue(); + } + + @Test + public void setChecked_uncheckMainSwitch_doubleTapPowerGestureDisabled() { + mController.setChecked(false); + assertThat(DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) + .isFalse(); + } +} From 7e6e2b81c26106fd2f4d919c300d02cfda5d4ef1 Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 15 Nov 2024 18:48:29 +0000 Subject: [PATCH 15/23] Create Double Tap Power Gesture For Camera Preference Controller Create Preference controller to select camera launch as a target action for the Double Tap Power Button gesture. Android Settings Feature Request: b/380287172 Bug: 379309894 Test: atest DoubleTapPowerForCameraLaunchPreferenceControllerTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I3b6b90177293066b04f9f4eb0139f8ac3b3812b0 --- ...TapPowerForCameraPreferenceController.java | 114 ++++++++++++++++++ ...owerForCameraPreferenceControllerTest.java | 98 +++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceControllerTest.java diff --git a/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceController.java new file mode 100644 index 00000000000..0c7c65a7ffa --- /dev/null +++ b/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceController.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +import android.content.Context; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; +import android.os.Looper; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; + +import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.core.lifecycle.LifecycleObserver; +import com.android.settingslib.core.lifecycle.events.OnStart; +import com.android.settingslib.core.lifecycle.events.OnStop; +import com.android.settingslib.widget.SelectorWithWidgetPreference; + +public class DoubleTapPowerForCameraPreferenceController extends BasePreferenceController + implements LifecycleObserver, OnStart, OnStop { + + @Nullable private Preference mPreference; + private final ContentObserver mSettingsObserver = + new ContentObserver(new Handler(Looper.getMainLooper())) { + @Override + public void onChange(boolean selfChange, @Nullable Uri uri) { + if (mPreference == null || uri == null) { + return; + } + if (uri.equals( + DoubleTapPowerSettingsUtils + .DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI)) { + mPreference.setEnabled( + DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled( + mContext)); + } else if (uri.equals( + DoubleTapPowerSettingsUtils + .DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION_URI)) { + updateState(mPreference); + } + } + }; + + public DoubleTapPowerForCameraPreferenceController( + @NonNull Context context, @NonNull String preferenceKey) { + super(context, preferenceKey); + } + + @Override + public int getAvailabilityStatus() { + if (!DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(mContext)) { + return UNSUPPORTED_ON_DEVICE; + } + return DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext) + ? AVAILABLE + : DISABLED_DEPENDENT_SETTING; + } + + @Override + public void displayPreference(@NonNull PreferenceScreen screen) { + super.displayPreference(screen); + mPreference = screen.findPreference(getPreferenceKey()); + } + + @Override + public void updateState(@NonNull Preference preference) { + super.updateState(preference); + if (preference instanceof SelectorWithWidgetPreference) { + ((SelectorWithWidgetPreference) preference) + .setChecked( + DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)); + } + } + + @Override + public boolean handlePreferenceTreeClick(@NonNull Preference preference) { + if (!getPreferenceKey().equals(preference.getKey())) { + return false; + } + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForCameraLaunch(mContext); + if (preference instanceof SelectorWithWidgetPreference) { + ((SelectorWithWidgetPreference) preference).setChecked(true); + } + return true; + } + + @Override + public void onStart() { + DoubleTapPowerSettingsUtils.registerObserver(mContext, mSettingsObserver); + } + + @Override + public void onStop() { + DoubleTapPowerSettingsUtils.unregisterObserver(mContext, mSettingsObserver); + } +} diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceControllerTest.java new file mode 100644 index 00000000000..cc710ec29e6 --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForCameraPreferenceControllerTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +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; + +import android.content.Context; +import android.content.res.Resources; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.internal.R; +import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.widget.SelectorWithWidgetPreference; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class DoubleTapPowerForCameraPreferenceControllerTest { + + private static final String KEY = "gesture_double_power_tap_launch_camera"; + private Context mContext; + private Resources mResources; + private DoubleTapPowerForCameraPreferenceController mController; + private SelectorWithWidgetPreference mPreference; + + @Before + public void setUp() { + mContext = spy(ApplicationProvider.getApplicationContext()); + mResources = mock(Resources.class); + when(mContext.getResources()).thenReturn(mResources); + mController = new DoubleTapPowerForCameraPreferenceController(mContext, KEY); + mPreference = new SelectorWithWidgetPreference(mContext); + } + + @Test + public void updateState_launchCameraEnabled_preferenceChecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForCameraLaunch(mContext); + + mController.updateState(mPreference); + assertThat(mPreference.isChecked()).isTrue(); + } + + @Test + public void updateState_launchCameraDisabled_preferenceNotChecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForWalletLaunch(mContext); + + mController.updateState(mPreference); + assertThat(mPreference.isChecked()).isFalse(); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureNotAvailable_preferenceUnsupported() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerButtonDisabled_preferenceDisabled() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerCameraLaunchEnabled_preferenceEnabled() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, true); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.AVAILABLE); + } +} From 235556daeb3bea1d804b528dc8fd79592e1e23f1 Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 15 Nov 2024 18:50:14 +0000 Subject: [PATCH 16/23] Create Double Tap Power For Wallet Launch Preference Controller Create preference controller for radio button to select wallet launch as target action for Double Tap Power Button gesture. Android Settings Feature Request: b/380287172 Bug: 379308160 Test: atest DoubleTapPowerForWalletLaunchPreferenceControllerTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: Ib1629996401ea88aeec2831a55fdc9f2ad9dcd5e --- ...TapPowerForWalletPreferenceController.java | 114 ++++++++++++++++++ ...owerForWalletPreferenceControllerTest.java | 100 +++++++++++++++ 2 files changed, 214 insertions(+) create mode 100644 src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceControllerTest.java diff --git a/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceController.java new file mode 100644 index 00000000000..56dda4d4953 --- /dev/null +++ b/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceController.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +import android.content.Context; +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; +import android.os.Looper; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; + +import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.core.lifecycle.LifecycleObserver; +import com.android.settingslib.core.lifecycle.events.OnStart; +import com.android.settingslib.core.lifecycle.events.OnStop; +import com.android.settingslib.widget.SelectorWithWidgetPreference; + +public class DoubleTapPowerForWalletPreferenceController extends BasePreferenceController + implements LifecycleObserver, OnStart, OnStop { + + @Nullable private Preference mPreference; + private final ContentObserver mSettingsObserver = + new ContentObserver(new Handler(Looper.getMainLooper())) { + @Override + public void onChange(boolean selfChange, @Nullable Uri uri) { + if (mPreference == null || uri == null) { + return; + } + if (uri.equals( + DoubleTapPowerSettingsUtils + .DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED_URI)) { + mPreference.setEnabled( + DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled( + mContext)); + } else if (uri.equals( + DoubleTapPowerSettingsUtils + .DOUBLE_TAP_POWER_BUTTON_GESTURE_TARGET_ACTION_URI)) { + updateState(mPreference); + } + } + }; + + public DoubleTapPowerForWalletPreferenceController( + @NonNull Context context, @NonNull String preferenceKey) { + super(context, preferenceKey); + } + + @Override + public int getAvailabilityStatus() { + if (!DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(mContext)) { + return UNSUPPORTED_ON_DEVICE; + } + return DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext) + ? AVAILABLE + : DISABLED_DEPENDENT_SETTING; + } + + @Override + public void displayPreference(@NonNull PreferenceScreen screen) { + super.displayPreference(screen); + mPreference = screen.findPreference(getPreferenceKey()); + } + + @Override + public void updateState(@NonNull Preference preference) { + super.updateState(preference); + if (preference instanceof SelectorWithWidgetPreference) { + ((SelectorWithWidgetPreference) preference) + .setChecked( + !DoubleTapPowerSettingsUtils + .isDoubleTapPowerButtonGestureForCameraLaunchEnabled(mContext)); + } + } + + @Override + public boolean handlePreferenceTreeClick(@NonNull Preference preference) { + if (!getPreferenceKey().equals(preference.getKey())) { + return false; + } + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForWalletLaunch(mContext); + if (preference instanceof SelectorWithWidgetPreference) { + ((SelectorWithWidgetPreference) preference).setChecked(true); + } + return true; + } + + @Override + public void onStart() { + DoubleTapPowerSettingsUtils.registerObserver(mContext, mSettingsObserver); + } + + @Override + public void onStop() { + DoubleTapPowerSettingsUtils.unregisterObserver(mContext, mSettingsObserver); + } +} diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceControllerTest.java new file mode 100644 index 00000000000..c86a82edd0d --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerForWalletPreferenceControllerTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +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; + +import android.content.Context; +import android.content.res.Resources; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.internal.R; +import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.widget.SelectorWithWidgetPreference; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class DoubleTapPowerForWalletPreferenceControllerTest { + + private static final String KEY = "gesture_double_power_tap_launch_wallet"; + private Context mContext; + private Resources mResources; + private DoubleTapPowerForWalletPreferenceController mController; + private SelectorWithWidgetPreference mPreference; + + @Before + public void setUp() { + mContext = spy(ApplicationProvider.getApplicationContext()); + mResources = mock(Resources.class); + when(mContext.getResources()).thenReturn(mResources); + mController = new DoubleTapPowerForWalletPreferenceController(mContext, KEY); + mPreference = new SelectorWithWidgetPreference(mContext); + } + + @Test + public void updateState_launchWalletEnabled_preferenceChecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForWalletLaunch(mContext); + + mController.updateState(mPreference); + + assertThat(mPreference.isChecked()).isTrue(); + } + + @Test + public void updateState_launchWalletDisabled_preferenceNotChecked() { + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForCameraLaunch(mContext); + + mController.updateState(mPreference); + + assertThat(mPreference.isChecked()).isFalse(); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureNotAvailable_preferenceUnsupported() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerButtonDisabled_preferenceDisabled() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerWalletLaunchEnabled_preferenceEnabled() { + when(mResources.getBoolean(R.bool.config_doubleTapPowerGestureEnabled)).thenReturn(true); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonGestureEnabled(mContext, true); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.AVAILABLE); + } +} From 75536b091ffdf9242b68fbf706bdc0fdfb35201f Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 29 Nov 2024 09:10:24 +0000 Subject: [PATCH 17/23] Refactor DoubleTapPowerPreferenceController DoubleTapPreferenceController was previously used as the controller for the "Quickly open camera" entry in the "System > Gestures" screen and as the controller for the toggle in the ["System > Gestures > Quickly open camera" screen. This CL separates the DoubleTapPowerPreferenceController into two new controllers to handle each case: - Double Tap Power Preference Controller to control the "Quickly open camera" entry - Double Tap Power To Open Camera Preference Controller to control the gesture's enable/disable toggle. Android Settings Feature Request: b/380287172 Bug: 381499912 Test: atest DoubleTapPowerPreferenceControllerTest Test: atest DoubleTapPowerToOpenCameraPreferenceControllerTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I73fc7d97e1e330163858a60a4ba9a63bd9b5574f --- res/xml/double_tap_power_settings.xml | 2 +- .../DoubleTapPowerPreferenceController.java | 56 ++---- ...PowerToOpenCameraPreferenceController.java | 78 +++++++++ ...oubleTapPowerPreferenceControllerTest.java | 58 +++---- ...rToOpenCameraPreferenceControllerTest.java | 162 ++++++++++++++++++ 5 files changed, 283 insertions(+), 73 deletions(-) create mode 100644 src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceControllerTest.java diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml index fb5dd52b913..deb171c27cd 100644 --- a/res/xml/double_tap_power_settings.xml +++ b/res/xml/double_tap_power_settings.xml @@ -31,6 +31,6 @@ android:title="@string/double_tap_power_for_camera_title" android:summary="@string/double_tap_power_for_camera_summary" app:keywords="@string/keywords_gesture" - app:controller="com.android.settings.gestures.DoubleTapPowerPreferenceController"/> + app:controller="com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController"/> diff --git a/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java index 3d2e1768b2e..86c955ba55b 100644 --- a/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java +++ b/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java @@ -21,22 +21,15 @@ import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_D import android.content.Context; import android.content.SharedPreferences; import android.provider.Settings; -import android.text.TextUtils; -import androidx.annotation.VisibleForTesting; +import androidx.annotation.NonNull; -public class DoubleTapPowerPreferenceController extends GesturePreferenceController { +import com.android.settings.R; +import com.android.settings.core.BasePreferenceController; - @VisibleForTesting - static final int ON = 0; - @VisibleForTesting - static final int OFF = 1; +public class DoubleTapPowerPreferenceController extends BasePreferenceController { - private static final String PREF_KEY_VIDEO = "gesture_double_tap_power_video"; - - private final String SECURE_KEY = CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED; - - public DoubleTapPowerPreferenceController(Context context, String key) { + public DoubleTapPowerPreferenceController(@NonNull Context context, @NonNull String key) { super(context, key); } @@ -45,7 +38,7 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl || prefs.getBoolean(DoubleTapPowerSettings.PREF_KEY_SUGGESTION_COMPLETE, false); } - private static boolean isGestureAvailable(Context context) { + private static boolean isGestureAvailable(@NonNull Context context) { return context.getResources() .getBoolean(com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled); } @@ -56,30 +49,17 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl } @Override - public boolean isSliceable() { - return TextUtils.equals(getPreferenceKey(), "gesture_double_tap_power"); - } - - @Override - public boolean isPublicSlice() { - return true; - } - - @Override - protected String getVideoPrefKey() { - return PREF_KEY_VIDEO; - } - - @Override - public boolean isChecked() { - final int cameraDisabled = Settings.Secure.getInt(mContext.getContentResolver(), - SECURE_KEY, ON); - return cameraDisabled == ON; - } - - @Override - public boolean setChecked(boolean isChecked) { - return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, - isChecked ? ON : OFF); + @NonNull + public CharSequence getSummary() { + final boolean isCameraDoubleTapPowerGestureEnabled = + Settings.Secure.getInt( + mContext.getContentResolver(), + CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + DoubleTapPowerToOpenCameraPreferenceController.ON) + == DoubleTapPowerToOpenCameraPreferenceController.ON; + return mContext.getText( + isCameraDoubleTapPowerGestureEnabled + ? R.string.gesture_setting_on + : R.string.gesture_setting_off); } } diff --git a/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceController.java new file mode 100644 index 00000000000..4362a661007 --- /dev/null +++ b/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceController.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 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. + */ +package com.android.settings.gestures; + +import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED; + +import android.content.Context; +import android.provider.Settings; +import android.text.TextUtils; + +import androidx.annotation.NonNull; + +import com.android.settings.R; +import com.android.settings.core.TogglePreferenceController; + +public class DoubleTapPowerToOpenCameraPreferenceController extends TogglePreferenceController { + + static final int ON = 0; + static final int OFF = 1; + + public DoubleTapPowerToOpenCameraPreferenceController( + @NonNull Context context, @NonNull String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + return mContext.getResources() + .getBoolean( + com.android.internal.R.bool + .config_cameraDoubleTapPowerGestureEnabled) + ? AVAILABLE + : UNSUPPORTED_ON_DEVICE; + } + + @Override + public boolean isChecked() { + return Settings.Secure.getInt( + mContext.getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON) + == ON; + } + + @Override + public boolean setChecked(boolean isChecked) { + return Settings.Secure.putInt( + mContext.getContentResolver(), + CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + isChecked ? ON : OFF); + } + + @Override + public boolean isSliceable() { + return TextUtils.equals(getPreferenceKey(), "gesture_double_tap_power"); + } + + @Override + public boolean isPublicSlice() { + return true; + } + + @Override + public int getSliceHighlightMenuRes() { + return R.string.menu_key_system; + } +} diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java index 72dd36e60a0..873eeda6c5c 100644 --- a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java @@ -18,9 +18,9 @@ package com.android.settings.gestures; import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED; -import static com.android.settings.gestures.DoubleTapPowerPreferenceController.OFF; -import static com.android.settings.gestures.DoubleTapPowerPreferenceController.ON; import static com.android.settings.gestures.DoubleTapPowerPreferenceController.isSuggestionComplete; +import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController.OFF; +import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController.ON; import static com.google.common.truth.Truth.assertThat; @@ -28,7 +28,9 @@ import android.content.ContentResolver; import android.content.Context; import android.content.SharedPreferences; import android.provider.Settings; +import android.text.TextUtils; +import com.android.settings.R; import com.android.settings.dashboard.suggestions.SuggestionFeatureProviderImpl; import com.android.settings.testutils.shadow.SettingsShadowResources; @@ -71,7 +73,7 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isAvailable_configIsTrue_shouldReturnFalse() { + public void isAvailable_configIsFalse_shouldReturnFalse() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, Boolean.FALSE); @@ -79,30 +81,12 @@ public class DoubleTapPowerPreferenceControllerTest { assertThat(mController.isAvailable()).isFalse(); } - @Test - public void testIsChecked_configIsNotSet_shouldReturnTrue() { - // Set the setting to be enabled. - Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON); - mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER); - - assertThat(mController.isChecked()).isTrue(); - } - - @Test - public void testIsChecked_configIsSet_shouldReturnFalse() { - // Set the setting to be disabled. - Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF); - mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER); - - assertThat(mController.isChecked()).isFalse(); - } - @Test public void isSuggestionCompleted_doubleTapPower_trueWhenNotAvailable() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, false); - assertThat(isSuggestionComplete(mContext, null/* prefs */)).isTrue(); + assertThat(isSuggestionComplete(mContext, null /* prefs */)).isTrue(); } @Test @@ -112,6 +96,7 @@ public class DoubleTapPowerPreferenceControllerTest { // No stored value in shared preferences if not visited yet. final SharedPreferences prefs = new SuggestionFeatureProviderImpl().getSharedPrefs(mContext); + assertThat(isSuggestionComplete(mContext, prefs)).isFalse(); } @@ -128,21 +113,26 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isSliceableCorrectKey_returnsTrue() { - final DoubleTapPowerPreferenceController controller = - new DoubleTapPowerPreferenceController(mContext, "gesture_double_tap_power"); - assertThat(controller.isSliceable()).isTrue(); + public void getSummary_doubleTapPowerEnabled_returnsOn() { + // Set the setting to be enabled. + Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON); + + assertThat( + TextUtils.equals( + mController.getSummary(), + mContext.getText(R.string.gesture_setting_on))) + .isTrue(); } @Test - public void isSliceableIncorrectKey_returnsFalse() { - final DoubleTapPowerPreferenceController controller = - new DoubleTapPowerPreferenceController(mContext, "bad_key"); - assertThat(controller.isSliceable()).isFalse(); - } + public void getSummary_doubleTapPowerDisabled_returnsOff() { + // Set the setting to be disabled. + Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF); - @Test - public void isPublicSlice_returnTrue() { - assertThat(mController.isPublicSlice()).isTrue(); + assertThat( + TextUtils.equals( + mController.getSummary(), + mContext.getText(R.string.gesture_setting_on))) + .isTrue(); } } diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceControllerTest.java new file mode 100644 index 00000000000..54d17ba258c --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerToOpenCameraPreferenceControllerTest.java @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.settings.gestures; + +import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED; + +import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController.OFF; +import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController.ON; + +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; + +import android.content.Context; +import android.content.res.Resources; +import android.platform.test.flag.junit.SetFlagsRule; +import android.provider.Settings; + +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import com.android.internal.R; +import com.android.settings.core.BasePreferenceController; +import com.android.settings.testutils.shadow.SettingsShadowResources; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +@RunWith(AndroidJUnit4.class) +@Config(shadows = SettingsShadowResources.class) +public class DoubleTapPowerToOpenCameraPreferenceControllerTest { + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + private Context mContext; + private Resources mResources; + private DoubleTapPowerToOpenCameraPreferenceController mController; + private static final String KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power"; + + @Before + public void setUp() { + mContext = spy(RuntimeEnvironment.getApplication()); + mResources = mock(Resources.class); + when(mContext.getResources()).thenReturn(mResources); + mController = + new DoubleTapPowerToOpenCameraPreferenceController(mContext, KEY_DOUBLE_TAP_POWER); + } + + @After + public void tearDown() { + SettingsShadowResources.reset(); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureDisabled_preferenceUnsupported() { + when(mResources.getBoolean(R.bool.config_cameraDoubleTapPowerGestureEnabled)) + .thenReturn(false); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE); + } + + @Test + public void getAvailabilityStatus_setDoubleTapPowerGestureEnabled_preferenceSupported() { + when(mResources.getBoolean(R.bool.config_cameraDoubleTapPowerGestureEnabled)) + .thenReturn(true); + + assertThat(mController.getAvailabilityStatus()) + .isEqualTo(BasePreferenceController.AVAILABLE); + } + + @Test + public void isChecked_configIsNotSet_returnsTrue() { + // Set the setting to be enabled. + Settings.Secure.putInt( + mContext.getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON); + + assertThat(mController.isChecked()).isTrue(); + } + + @Test + public void isChecked_setConfigFalse_returnsFalse() { + // Set the setting to be disabled. + Settings.Secure.putInt( + mContext.getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF); + + assertThat(mController.isChecked()).isFalse(); + } + + @Test + public void isChecked_setConfigTrue_returnsFalse() { + // Set the setting to be disabled. + Settings.Secure.putInt( + mContext.getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON); + + assertThat(mController.isChecked()).isTrue(); + } + + @Test + public void setChecked_checkToggle_cameraDoubleTapPowerGestureEnabled() { + mController.setChecked(true); + + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + OFF)) + .isEqualTo(ON); + } + + @Test + public void setChecked_uncheckToggle_cameraDoubleTapPowerGestureDisabled() { + mController.setChecked(false); + + assertThat( + Settings.Secure.getInt( + mContext.getContentResolver(), + CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + ON)) + .isEqualTo(OFF); + } + + @Test + public void isSliceableCorrectKey_returnsTrue() { + final DoubleTapPowerToOpenCameraPreferenceController controller = + new DoubleTapPowerToOpenCameraPreferenceController( + mContext, "gesture_double_tap_power"); + + assertThat(controller.isSliceable()).isTrue(); + } + + @Test + public void isSliceableIncorrectKey_returnsFalse() { + final DoubleTapPowerToOpenCameraPreferenceController controller = + new DoubleTapPowerToOpenCameraPreferenceController(mContext, "bad_key"); + + assertThat(controller.isSliceable()).isFalse(); + } + + @Test + public void isPublicSlice_returnTrue() { + assertThat(mController.isPublicSlice()).isTrue(); + } +} From 406a01dfabeeccdafa60d6ef41569057f6b75de0 Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Fri, 29 Nov 2024 19:43:27 +0000 Subject: [PATCH 18/23] Rename Double Tap Power To Open Camera Gesture Xml Rename double_tap_power_settings.xml to double_tap_power_to_open_camera_settings.xml Android Settings Feature Request: b/380287172 Bug: 381554683 Test: atest DoubleTapPowerSettingsTest Flag: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I6ff3c0384602a5f0eeeafcc560e7854af8480f99 --- ... => double_tap_power_to_open_camera_settings.xml} | 7 +++---- .../settings/gestures/DoubleTapPowerSettings.java | 4 ++-- .../gestures/DoubleTapPowerSettingsTest.java | 12 ++++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) rename res/xml/{double_tap_power_settings.xml => double_tap_power_to_open_camera_settings.xml} (82%) diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_to_open_camera_settings.xml similarity index 82% rename from res/xml/double_tap_power_settings.xml rename to res/xml/double_tap_power_to_open_camera_settings.xml index deb171c27cd..315c7f04da4 100644 --- a/res/xml/double_tap_power_settings.xml +++ b/res/xml/double_tap_power_to_open_camera_settings.xml @@ -18,19 +18,18 @@ + settings:lottie_rawRes="@drawable/quickly_open_camera"/> + settings:keywords="@string/keywords_gesture" + settings:controller="com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController"/> diff --git a/src/com/android/settings/gestures/DoubleTapPowerSettings.java b/src/com/android/settings/gestures/DoubleTapPowerSettings.java index 577758df396..75140ed8c31 100644 --- a/src/com/android/settings/gestures/DoubleTapPowerSettings.java +++ b/src/com/android/settings/gestures/DoubleTapPowerSettings.java @@ -56,9 +56,9 @@ public class DoubleTapPowerSettings extends DashboardFragment { @Override protected int getPreferenceScreenResId() { - return R.xml.double_tap_power_settings; + return R.xml.double_tap_power_to_open_camera_settings; } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.double_tap_power_settings); + new BaseSearchIndexProvider(R.xml.double_tap_power_to_open_camera_settings); } diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java index a08b81800a4..10e2565b345 100644 --- a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java @@ -20,6 +20,8 @@ import static com.google.common.truth.Truth.assertThat; import android.provider.SearchIndexableResource; +import com.android.settings.R; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -38,11 +40,17 @@ public class DoubleTapPowerSettingsTest { mSettings = new DoubleTapPowerSettings(); } + @Test + public void getPreferenceResId_returnsResId() { + assertThat(mSettings.getPreferenceScreenResId()) + .isEqualTo(R.xml.double_tap_power_to_open_camera_settings); + } + @Test public void testSearchIndexProvider_shouldIndexResource() { final List indexRes = - DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex( - RuntimeEnvironment.application, true /* enabled */); + DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex( + RuntimeEnvironment.application, true /* enabled */); assertThat(indexRes).isNotNull(); assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId()); From d3af193384ed4aa68dc3275f882b78c15e540aad Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Mon, 18 Nov 2024 07:11:26 +0000 Subject: [PATCH 19/23] Support wallet launch in Double Tap Power Gesture Settings Modify Double Tap Power Gesture Settings screen to be able to set the gesture to launch the wallet. If the feature flag is disabled, the Double Tap Power Gesture Settings screen defaults to the current screen ("Quickly open camera"), which only provides the option to open the camera upon detecting the gesture. If the feature flag is enabled, the Double Tap Power Gesture Settings screen defaults to the new "Double Tap Power Button" screen, which provides the option to open the camera, the wallet, or neither upon detecting the gesture. Android Settings Feature Request: b/380287172 Bug: 378131008 Test: manual tested screen alternates based on feature flag Test: atest DoubleTapPowerSettingsTest Test: atest DoubleTapPowerPreferenceControllerTest Test: atest DoubleTapPowerToOpenCameraPreferenceControllerTest FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: I1fc05ab3cfee2e86a80a1756655c368aae16747c --- res/values/strings.xml | 17 ++ res/xml/double_tap_power_settings.xml | 44 +++++ res/xml/gestures.xml | 2 +- .../DoubleTapPowerPreferenceController.java | 54 ++++-- .../gestures/DoubleTapPowerSettings.java | 24 ++- ...oubleTapPowerPreferenceControllerTest.java | 159 +++++++++++++++++- .../gestures/DoubleTapPowerSettingsTest.java | 34 +++- 7 files changed, 306 insertions(+), 28 deletions(-) create mode 100644 res/xml/double_tap_power_settings.xml diff --git a/res/values/strings.xml b/res/values/strings.xml index 525de4796a0..ebd6d60ef55 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -11158,6 +11158,23 @@ To quickly open camera, press the power button twice. Works from any screen. + + Double tap power button + + %1$s / %2$s + + Use double tap + + Double Tap Power Button + + Open Camera + + Access Camera + + Open Wallet + + Access Wallet + Flip camera for selfie diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml new file mode 100644 index 00000000000..cf4a2f60217 --- /dev/null +++ b/res/xml/double_tap_power_settings.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + diff --git a/res/xml/gestures.xml b/res/xml/gestures.xml index 035c7f7c801..bfb359ae804 100644 --- a/res/xml/gestures.xml +++ b/res/xml/gestures.xml @@ -29,7 +29,7 @@ diff --git a/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java b/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java index 86c955ba55b..686d64cf1f5 100644 --- a/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java +++ b/src/com/android/settings/gestures/DoubleTapPowerPreferenceController.java @@ -23,6 +23,8 @@ import android.content.SharedPreferences; import android.provider.Settings; import androidx.annotation.NonNull; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.BasePreferenceController; @@ -39,8 +41,12 @@ public class DoubleTapPowerPreferenceController extends BasePreferenceController } private static boolean isGestureAvailable(@NonNull Context context) { - return context.getResources() - .getBoolean(com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled); + if (!android.service.quickaccesswallet.Flags.launchWalletOptionOnPowerDoubleTap()) { + return context.getResources() + .getBoolean( + com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled); + } + return DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureAvailable(context); } @Override @@ -48,18 +54,42 @@ public class DoubleTapPowerPreferenceController extends BasePreferenceController return isGestureAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE; } + @Override + public void displayPreference(@NonNull PreferenceScreen screen) { + if (!android.service.quickaccesswallet.Flags.launchWalletOptionOnPowerDoubleTap()) { + final Preference preference = screen.findPreference(getPreferenceKey()); + if (preference != null) { + preference.setTitle(R.string.double_tap_power_for_camera_title); + } + } + super.displayPreference(screen); + } + @Override @NonNull public CharSequence getSummary() { - final boolean isCameraDoubleTapPowerGestureEnabled = - Settings.Secure.getInt( - mContext.getContentResolver(), - CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, - DoubleTapPowerToOpenCameraPreferenceController.ON) - == DoubleTapPowerToOpenCameraPreferenceController.ON; - return mContext.getText( - isCameraDoubleTapPowerGestureEnabled - ? R.string.gesture_setting_on - : R.string.gesture_setting_off); + if (!android.service.quickaccesswallet.Flags.launchWalletOptionOnPowerDoubleTap()) { + final boolean isCameraDoubleTapPowerGestureEnabled = + Settings.Secure.getInt( + mContext.getContentResolver(), + CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, + DoubleTapPowerToOpenCameraPreferenceController.ON) + == DoubleTapPowerToOpenCameraPreferenceController.ON; + return mContext.getText( + isCameraDoubleTapPowerGestureEnabled + ? R.string.gesture_setting_on + : R.string.gesture_setting_off); + } + if (DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureEnabled(mContext)) { + final CharSequence onString = + mContext.getText(com.android.settings.R.string.gesture_setting_on); + final CharSequence actionString = + DoubleTapPowerSettingsUtils.isDoubleTapPowerButtonGestureForCameraLaunchEnabled( + mContext) + ? mContext.getText(R.string.double_tap_power_camera_action_summary) + : mContext.getText(R.string.double_tap_power_wallet_action_summary); + return mContext.getString(R.string.double_tap_power_summary, onString, actionString); + } + return mContext.getText(com.android.settings.R.string.gesture_setting_off); } } diff --git a/src/com/android/settings/gestures/DoubleTapPowerSettings.java b/src/com/android/settings/gestures/DoubleTapPowerSettings.java index 75140ed8c31..076f23fa660 100644 --- a/src/com/android/settings/gestures/DoubleTapPowerSettings.java +++ b/src/com/android/settings/gestures/DoubleTapPowerSettings.java @@ -19,6 +19,9 @@ package com.android.settings.gestures; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.SharedPreferences; +import android.provider.SearchIndexableResource; + +import androidx.annotation.NonNull; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; @@ -27,6 +30,8 @@ import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.search.SearchIndexable; +import java.util.List; + @SearchIndexable public class DoubleTapPowerSettings extends DashboardFragment { @@ -56,9 +61,24 @@ public class DoubleTapPowerSettings extends DashboardFragment { @Override protected int getPreferenceScreenResId() { - return R.xml.double_tap_power_to_open_camera_settings; + return android.service.quickaccesswallet.Flags.launchWalletOptionOnPowerDoubleTap() + ? R.xml.double_tap_power_settings + : R.xml.double_tap_power_to_open_camera_settings; } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.double_tap_power_to_open_camera_settings); + new BaseSearchIndexProvider() { + @Override + @NonNull + public List getXmlResourcesToIndex( + @NonNull Context context, boolean enabled) { + final SearchIndexableResource sir = new SearchIndexableResource(context); + sir.xmlResId = + android.service.quickaccesswallet.Flags + .launchWalletOptionOnPowerDoubleTap() + ? R.xml.double_tap_power_settings + : R.xml.double_tap_power_to_open_camera_settings; + return List.of(sir); + } + }; } diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java index 873eeda6c5c..17b03f355bf 100644 --- a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerPreferenceControllerTest.java @@ -17,6 +17,7 @@ package com.android.settings.gestures; import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED; +import static android.provider.Settings.Secure.DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED; import static com.android.settings.gestures.DoubleTapPowerPreferenceController.isSuggestionComplete; import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreferenceController.OFF; @@ -24,18 +25,29 @@ import static com.android.settings.gestures.DoubleTapPowerToOpenCameraPreference import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import android.content.ContentResolver; import android.content.Context; import android.content.SharedPreferences; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; import android.provider.Settings; +import android.service.quickaccesswallet.Flags; import android.text.TextUtils; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; + import com.android.settings.R; import com.android.settings.dashboard.suggestions.SuggestionFeatureProviderImpl; import com.android.settings.testutils.shadow.SettingsShadowResources; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -46,16 +58,22 @@ import org.robolectric.annotation.Config; @Config(shadows = SettingsShadowResources.class) public class DoubleTapPowerPreferenceControllerTest { + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private Context mContext; private ContentResolver mContentResolver; private DoubleTapPowerPreferenceController mController; + private Preference mPreference; + private PreferenceScreen mScreen; private static final String KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power"; @Before public void setUp() { - mContext = RuntimeEnvironment.application; + mContext = RuntimeEnvironment.getApplication(); mContentResolver = mContext.getContentResolver(); mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER); + mPreference = new Preference(mContext); + mScreen = mock(PreferenceScreen.class); + when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); } @After @@ -64,7 +82,26 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isAvailable_configIsTrue_shouldReturnTrue() { + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isAvailable_flagEnabled_configIsTrue_returnsTrue() { + SettingsShadowResources.overrideResource( + com.android.internal.R.bool.config_doubleTapPowerGestureEnabled, Boolean.TRUE); + + assertThat(mController.isAvailable()).isTrue(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isAvailable_flagEnabled_configIsFalse_returnsFalse() { + SettingsShadowResources.overrideResource( + com.android.internal.R.bool.config_doubleTapPowerGestureEnabled, Boolean.FALSE); + + assertThat(mController.isAvailable()).isFalse(); + } + + @Test + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isAvailable_flagDisabled_configIsTrue_returnsTrue() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, Boolean.TRUE); @@ -73,7 +110,8 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isAvailable_configIsFalse_shouldReturnFalse() { + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isAvailable_flagDisabled_configIsFalse_returnsFalse() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, Boolean.FALSE); @@ -82,7 +120,42 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isSuggestionCompleted_doubleTapPower_trueWhenNotAvailable() { + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_enableFlag_doubleTapPower_trueWhenNotAvailable() { + SettingsShadowResources.overrideResource( + com.android.internal.R.bool.config_doubleTapPowerGestureEnabled, false); + + assertThat(isSuggestionComplete(mContext, null /* prefs */)).isTrue(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_enableFlag_doubleTapPower_falseWhenNotVisited() { + SettingsShadowResources.overrideResource( + com.android.internal.R.bool.config_doubleTapPowerGestureEnabled, true); + // No stored value in shared preferences if not visited yet. + final SharedPreferences prefs = + new SuggestionFeatureProviderImpl().getSharedPrefs(mContext); + + assertThat(isSuggestionComplete(mContext, prefs)).isFalse(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_enableFlag_doubleTapPower_trueWhenVisited() { + SettingsShadowResources.overrideResource( + com.android.internal.R.bool.config_doubleTapPowerGestureEnabled, true); + // No stored value in shared preferences if not visited yet. + final SharedPreferences prefs = + new SuggestionFeatureProviderImpl().getSharedPrefs(mContext); + prefs.edit().putBoolean(DoubleTapPowerSettings.PREF_KEY_SUGGESTION_COMPLETE, true).commit(); + + assertThat(isSuggestionComplete(mContext, prefs)).isTrue(); + } + + @Test + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_disableFlag_doubleTapPower_trueWhenNotAvailable() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, false); @@ -90,7 +163,8 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isSuggestionCompleted_doubleTapPower_falseWhenNotVisited() { + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_disableFlag_doubleTapPower_falseWhenNotVisited() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true); // No stored value in shared preferences if not visited yet. @@ -101,7 +175,8 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void isSuggestionCompleted_doubleTapPower_trueWhenVisited() { + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void isSuggestionCompleted_disableFlag_doubleTapPower_trueWhenVisited() { SettingsShadowResources.overrideResource( com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true); // No stored value in shared preferences if not visited yet. @@ -113,7 +188,20 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void getSummary_doubleTapPowerEnabled_returnsOn() { + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void displayPreference_flagDisabled_doubleTapPowerLegacyTitleIsDisplayed() { + mController.displayPreference(mScreen); + + assertThat( + TextUtils.equals( + mPreference.getTitle(), + mContext.getText(R.string.double_tap_power_for_camera_title))) + .isTrue(); + } + + @Test + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getSummary_flagDisabled_doubleTapPowerEnabled_returnsOn() { // Set the setting to be enabled. Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON); @@ -125,14 +213,67 @@ public class DoubleTapPowerPreferenceControllerTest { } @Test - public void getSummary_doubleTapPowerDisabled_returnsOff() { + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getSummary_flagDisabled_doubleTapPowerDisabled_returnsOff() { // Set the setting to be disabled. Settings.Secure.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF); assertThat( TextUtils.equals( mController.getSummary(), - mContext.getText(R.string.gesture_setting_on))) + mContext.getText(R.string.gesture_setting_off))) + .isTrue(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getSummary_flagEnabled_doubleTapPowerDisabled_returnsOff() { + // Set the setting to be disabled. + Settings.Secure.putInt( + mContentResolver, DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, 0 /* OFF */); + + assertThat( + TextUtils.equals( + mController.getSummary(), + mContext.getText(R.string.gesture_setting_off))) + .isTrue(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getSummary_flagEnabled_doubleTapPowerEnabled_cameraTargetAction_returnsSummary() { + // Set the setting to be enabled. + Settings.Secure.putInt( + mContentResolver, DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, 1 /* ON */); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForCameraLaunch(mContext); + + assertThat( + TextUtils.equals( + mController.getSummary(), + mContext.getString( + R.string.double_tap_power_summary, + mContext.getText(R.string.gesture_setting_on), + mContext.getText( + R.string.double_tap_power_camera_action_summary)))) + .isTrue(); + } + + @Test + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getSummary_flagEnabled_doubleTapPowerEnabled_walletTargetAction_returnsSummary() { + // Set the setting to be enabled. + Settings.Secure.putInt( + mContentResolver, DOUBLE_TAP_POWER_BUTTON_GESTURE_ENABLED, 1 /* ON */); + DoubleTapPowerSettingsUtils.setDoubleTapPowerButtonForWalletLaunch(mContext); + + assertThat( + TextUtils.equals( + mController.getSummary(), + mContext.getString( + R.string.double_tap_power_summary, + mContext.getText(R.string.gesture_setting_on), + mContext.getText( + R.string.double_tap_power_wallet_action_summary)))) .isTrue(); } } diff --git a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java index 10e2565b345..7d4f52e67a2 100644 --- a/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java +++ b/tests/robotests/src/com/android/settings/gestures/DoubleTapPowerSettingsTest.java @@ -18,11 +18,16 @@ package com.android.settings.gestures; import static com.google.common.truth.Truth.assertThat; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; import android.provider.SearchIndexableResource; +import android.service.quickaccesswallet.Flags; import com.android.settings.R; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -33,6 +38,7 @@ import java.util.List; @RunWith(RobolectricTestRunner.class) public class DoubleTapPowerSettingsTest { + @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private DoubleTapPowerSettings mSettings; @Before @@ -41,18 +47,38 @@ public class DoubleTapPowerSettingsTest { } @Test - public void getPreferenceResId_returnsResId() { + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getPreferenceScreenResId_flagEnabled_returnsFlagEnabledResId() { + assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(R.xml.double_tap_power_settings); + } + + @Test + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void getPreferenceScreenResId_flagDisabled_returnsFlagDisabledResId() { assertThat(mSettings.getPreferenceScreenResId()) .isEqualTo(R.xml.double_tap_power_to_open_camera_settings); } @Test - public void testSearchIndexProvider_shouldIndexResource() { + @EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void testSearchIndexProvider_flagEnabled_shouldIndexFlagEnabledResource() { final List indexRes = DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex( - RuntimeEnvironment.application, true /* enabled */); + RuntimeEnvironment.getApplication(), true /* enabled */); assertThat(indexRes).isNotNull(); - assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId()); + assertThat(indexRes.get(0).xmlResId).isEqualTo(R.xml.double_tap_power_settings); + } + + @Test + @DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP) + public void testSearchIndexProvider_flagDisabled_shouldIndexFlagDisabledResource() { + final List indexRes = + DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex( + RuntimeEnvironment.getApplication(), true /* enabled */); + + assertThat(indexRes).isNotNull(); + assertThat(indexRes.get(0).xmlResId) + .isEqualTo(R.xml.double_tap_power_to_open_camera_settings); } } From 18d0d2639588f06f5630eb0be7feffc1b0ec2cc7 Mon Sep 17 00:00:00 2001 From: Lorenzo Lucena Maguire Date: Mon, 2 Dec 2024 06:06:00 +0000 Subject: [PATCH 20/23] Create Double Tap Power Illustrations based on target action Creates illustration for when double tap power gesture is set to open wallet and preference controller to alternate illustration based on gesture target action Android Settings Feature Request: b/380287172 Test: atest DoubleTapPowerIllustrationPreferenceControllerTest Test: manually verified illustration corresponds to selected target action Bug: 381789181 FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap Change-Id: Id73a38e09bd72856d46d74f04c0c0d2b3f989929 --- .../double_tap_power_for_wallet.xml | 36 +++++++ res/drawable/double_tap_power_for_wallet.xml | 36 +++++++ res/xml/double_tap_power_settings.xml | 3 +- ...PowerIllustrationPreferenceController.java | 96 +++++++++++++++++++ ...rIllustrationPreferenceControllerTest.java | 74 ++++++++++++++ 5 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 res/drawable-night/double_tap_power_for_wallet.xml create mode 100644 res/drawable/double_tap_power_for_wallet.xml create mode 100644 src/com/android/settings/gestures/DoubleTapPowerIllustrationPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/gestures/DoubleTapPowerIllustrationPreferenceControllerTest.java diff --git a/res/drawable-night/double_tap_power_for_wallet.xml b/res/drawable-night/double_tap_power_for_wallet.xml new file mode 100644 index 00000000000..9c3de368258 --- /dev/null +++ b/res/drawable-night/double_tap_power_for_wallet.xml @@ -0,0 +1,36 @@ + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/double_tap_power_for_wallet.xml b/res/drawable/double_tap_power_for_wallet.xml new file mode 100644 index 00000000000..606c337a24d --- /dev/null +++ b/res/drawable/double_tap_power_for_wallet.xml @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml index cf4a2f60217..783d045b5d5 100644 --- a/res/xml/double_tap_power_settings.xml +++ b/res/xml/double_tap_power_settings.xml @@ -22,7 +22,8 @@ + settings:lottie_rawRes="@drawable/quickly_open_camera" + settings:controller="com.android.settings.gestures.DoubleTapPowerIllustrationPreferenceController"/> Date: Wed, 4 Dec 2024 00:14:09 +0000 Subject: [PATCH 21/23] Updates A11y Shortcut animations to not loop in code. Continuously repeated animations go against accessibility guidelines to avoid unstoppable motion. The animation files themselves have been updated to loop twice so that the user can still see the animation temporarily. The loop restarts if the user exits and enters the page again. Bug: 370661517 Flag: EXEMPT minor bugfix with resource changes Test: Manually observe animations Change-Id: I52348a094680ef345bf8c2b12ab91c9406bf5cb4 --- ...ility_shortcut_type_2finger_doubletap.json | 2815 ++++------------ res/raw/accessibility_shortcut_type_fab.json | 1510 ++------- ...accessibility_shortcut_type_tripletap.json | 2944 ++++------------- .../AccessibilityShortcutsTutorial.java | 4 +- .../shortcuts/ShortcutOptionPreference.java | 4 +- 5 files changed, 1665 insertions(+), 5612 deletions(-) diff --git a/res/raw/accessibility_shortcut_type_2finger_doubletap.json b/res/raw/accessibility_shortcut_type_2finger_doubletap.json index 73299d5f313..d9cdb0895b9 100644 --- a/res/raw/accessibility_shortcut_type_2finger_doubletap.json +++ b/res/raw/accessibility_shortcut_type_2finger_doubletap.json @@ -2,10 +2,10 @@ "v": "5.12.1", "fr": 60, "ip": 0, - "op": 120, + "op": 86, "w": 412, "h": 300, - "nm": "Accessibility_Two_Tap_v5_export", + "nm": "Accessibility_Two_Tap_v5_export 2", "ddd": 0, "assets": [], "layers": [ @@ -21,428 +21,184 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 2.473, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 8.406, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 11.865, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 17.135, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 19.609, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 25.539, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 29, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 59.727, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 62.199, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 68.133, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 71.592, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 76.861, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 79.336, + "s": [50] + }, + { "t": 85.265625, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 290.932, - 149.932, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [290.932, 149.932, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 4.943, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 8.406, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 11.865, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 17.135, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 22.078, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 25.539, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 29, - "s": [ - 150, - 150, - 100 - ] - } + "s": [150, 150, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 59.727, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 64.67, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 68.133, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 71.592, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 76.861, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 81.805, + "s": [100, 100, 100] + }, + { "t": 85.265625, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -461,58 +217,22 @@ "a": 0, "k": { "i": [ - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ], - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ] + [-20.621, 0], + [0, 20.621], + [20.621, 0], + [0, -20.621] ], "o": [ - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ], - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ] + [20.621, 0], + [0, -20.621], + [-20.621, 0], + [0, 20.621] ], "v": [ - [ - 0, - 37.338 - ], - [ - 37.338, - 0 - ], - [ - 0, - -37.338 - ], - [ - -37.338, - 0 - ] + [0, 37.338], + [37.338, 0], + [0, -37.338], + [-37.338, 0] ], "c": true }, @@ -526,24 +246,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -556,19 +263,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -577,50 +275,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -651,428 +312,184 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 2.473, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 8.406, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 11.865, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 17.135, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 19.609, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 25.539, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 29, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 59.727, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 62.199, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 68.133, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 71.592, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 76.861, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 79.336, + "s": [50] + }, + { "t": 85.265625, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 290.934, - 149.934, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [290.934, 149.934, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 4.943, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 8.406, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 11.865, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 17.135, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 22.078, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 25.539, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 29, - "s": [ - 90, - 90, - 100 - ] - } + "s": [90, 90, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 59.727, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 64.67, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 68.133, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 71.592, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 76.861, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 81.805, + "s": [100, 100, 100] + }, + { "t": 85.265625, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -1091,58 +508,22 @@ "a": 0, "k": { "i": [ - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ], - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ] + [-31.444, 0], + [0, 31.444], + [31.444, 0], + [0, -31.444] ], "o": [ - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ], - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ] + [31.444, 0], + [0, -31.444], + [-31.444, 0], + [0, 31.444] ], "v": [ - [ - 0, - 56.934 - ], - [ - 56.934, - 0 - ], - [ - 0, - -56.934 - ], - [ - -56.934, - 0 - ] + [0, 56.934], + [56.934, 0], + [0, -56.934], + [-56.934, 0] ], "c": true }, @@ -1156,24 +537,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -1186,19 +554,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -1207,50 +566,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -1281,428 +603,184 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0.273, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 2.746, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 8.68, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 12.137, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 17.135, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 19.607, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 25.541, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 29, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 60, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 62.473, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 68.406, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 71.863, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 76.861, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 79.334, + "s": [50] + }, + { "t": 85.267578125, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 121.932, - 149.932, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [121.932, 149.932, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0.273, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 5.219, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 8.68, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 12.137, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 17.135, - "s": [ - 150, - 150, - 100 - ] + "s": [150, 150, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 22.08, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 25.541, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 29, - "s": [ - 150, - 150, - 100 - ] - } + "s": [150, 150, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 60, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 64.945, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 68.406, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 71.863, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 76.861, + "s": [150, 150, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 81.807, + "s": [100, 100, 100] + }, + { "t": 85.267578125, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -1721,58 +799,22 @@ "a": 0, "k": { "i": [ - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ], - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ] + [-20.621, 0], + [0, 20.621], + [20.621, 0], + [0, -20.621] ], "o": [ - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ], - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ] + [20.621, 0], + [0, -20.621], + [-20.621, 0], + [0, 20.621] ], "v": [ - [ - 0, - 37.338 - ], - [ - 37.338, - 0 - ], - [ - 0, - -37.338 - ], - [ - -37.338, - 0 - ] + [0, 37.338], + [37.338, 0], + [0, -37.338], + [-37.338, 0] ], "c": true }, @@ -1786,24 +828,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -1816,19 +845,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -1837,50 +857,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -1911,428 +894,184 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0.273, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 2.746, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 8.68, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 12.137, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 17.135, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 19.607, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 25.541, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 29, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 60, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 62.473, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 68.406, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 71.863, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 76.861, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 79.334, + "s": [50] + }, + { "t": 85.267578125, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 121.934, - 149.934, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [121.934, 149.934, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0.273, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 5.219, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 8.68, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 12.137, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 17.135, - "s": [ - 90, - 90, - 100 - ] + "s": [90, 90, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 22.08, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 25.541, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 29, - "s": [ - 90, - 90, - 100 - ] - } + "s": [90, 90, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 60, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 64.945, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 68.406, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 71.863, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 76.861, + "s": [90, 90, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 81.807, + "s": [100, 100, 100] + }, + { "t": 85.267578125, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -2351,58 +1090,22 @@ "a": 0, "k": { "i": [ - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ], - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ] + [-31.444, 0], + [0, 31.444], + [31.444, 0], + [0, -31.444] ], "o": [ - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ], - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ] + [31.444, 0], + [0, -31.444], + [-31.444, 0], + [0, 31.444] ], "v": [ - [ - 0, - 56.934 - ], - [ - 56.934, - 0 - ], - [ - 0, - -56.934 - ], - [ - -56.934, - 0 - ] + [0, 56.934], + [56.934, 0], + [0, -56.934], + [-56.934, 0] ], "c": true }, @@ -2416,24 +1119,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -2446,19 +1136,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -2467,50 +1148,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -2537,46 +1181,11 @@ "cl": "black", "sr": 1, "ks": { - "o": { - "a": 0, - "k": 100, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206, - 150, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, - "s": { - "a": 0, - "k": [ - 100, - 100, - 100 - ], - "ix": 6, - "l": 2 - } + "o": { "a": 0, "k": 100, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206, 150, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6, "l": 2 } }, "ao": 0, "shapes": [ @@ -2591,106 +1200,34 @@ "a": 0, "k": { "i": [ - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.5 - ], - [ - 0, - 0 - ], - [ - 15.2, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ] + [-15.3, 0], + [0, 0], + [0, 15.5], + [0, 0], + [15.2, 0], + [0, 0], + [0, -15.7], + [0, 0] ], "o": [ - [ - 0, - 0 - ], - [ - 15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ], - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.7 - ] + [0, 0], + [15.3, 0], + [0, 0], + [0, -15.7], + [0, 0], + [-15.3, 0], + [0, 0], + [0, 15.7] ], "v": [ - [ - -178.2, - 150 - ], - [ - 178.2, - 150 - ], - [ - 206, - 121.7 - ], - [ - 206, - -121.5 - ], - [ - 178.3, - -150 - ], - [ - -178.2, - -150 - ], - [ - -206, - -121.5 - ], - [ - -206, - 121.5 - ] + [-178.2, 150], + [178.2, 150], + [206, 121.7], + [206, -121.5], + [178.3, -150], + [-178.2, -150], + [-206, -121.5], + [-206, 121.5] ], "c": true }, @@ -2702,21 +1239,8 @@ }, { "ty": "fl", - "c": { - "a": 0, - "k": [ - 0, - 0, - 0, - 1 - ], - "ix": 4 - }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "c": { "a": 0, "k": [0, 0, 0, 1], "ix": 4 }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -2725,50 +1249,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -2789,16 +1276,8 @@ } ], "markers": [ - { - "tm": 119, - "cm": "2", - "dr": 0 - }, - { - "tm": 240, - "cm": "1", - "dr": 0 - } + { "tm": 119, "cm": "2", "dr": 0 }, + { "tm": 240, "cm": "1", "dr": 0 } ], "props": {} -} \ No newline at end of file +} diff --git a/res/raw/accessibility_shortcut_type_fab.json b/res/raw/accessibility_shortcut_type_fab.json index 6029d918cf1..8623ac0c852 100644 --- a/res/raw/accessibility_shortcut_type_fab.json +++ b/res/raw/accessibility_shortcut_type_fab.json @@ -2,10 +2,10 @@ "v": "5.12.1", "fr": 60, "ip": 0, - "op": 181, + "op": 330, "w": 412, "h": 300, - "nm": "Accessibility_Shortcut_export", + "nm": "Accessibility_Shortcut_v2_export 2", "ddd": 0, "assets": [], "layers": [ @@ -16,342 +16,175 @@ "nm": "Null 1", "sr": 1, "ks": { - "o": { - "a": 0, - "k": 0, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, + "o": { "a": 0, "k": 0, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, "p": { "a": 1, "k": [ { - "i": { - "x": 0.8, - "y": 0.15 - }, - "o": { - "x": 0.3, - "y": 0 - }, + "i": { "x": 0.8, "y": 0.15 }, + "o": { "x": 0.3, "y": 0 }, "t": 30, - "s": [ - 412, - 154, - 0 - ], - "to": [ - 0, - 0.609, - 0 - ], - "ti": [ - 0, - 0, - 0 - ] + "s": [412, 154, 0], + "to": [0, 0.609, 0], + "ti": [0, 0, 0] }, { - "i": { - "x": 0.1, - "y": 1 - }, - "o": { - "x": 0.05, - "y": 0.7 - }, + "i": { "x": 0.1, "y": 1 }, + "o": { "x": 0.05, "y": 0.7 }, "t": 35, - "s": [ - 412, - 178.4, - 0 - ], - "to": [ - 0, - 0, - 0 - ], - "ti": [ - 0, - -5.757, - 0 - ] + "s": [412, 178.4, 0], + "to": [0, 0, 0], + "ti": [0, -5.757, 0] }, { - "i": { - "x": 0.833, - "y": 0.833 - }, - "o": { - "x": 0.167, - "y": 0.167 - }, + "i": { "x": 0.833, "y": 0.833 }, + "o": { "x": 0.167, "y": 0.167 }, "t": 60, - "s": [ - 412, - 215, - 0 - ], - "to": [ - 0, - 0, - 0 - ], - "ti": [ - 0, - 0, - 0 - ] + "s": [412, 215, 0], + "to": [0, 0, 0], + "ti": [0, 0, 0] }, { - "i": { - "x": 0.8, - "y": 0.15 - }, - "o": { - "x": 0.3, - "y": 0 - }, + "i": { "x": 0.8, "y": 0.15 }, + "o": { "x": 0.3, "y": 0 }, "t": 120, - "s": [ - 412, - 215, - 0 - ], - "to": [ - 0, - -0.609, - 0 - ], - "ti": [ - 0, - 0, - 0 - ] + "s": [412, 215, 0], + "to": [0, -0.609, 0], + "ti": [0, 0, 0] }, { - "i": { - "x": 0.1, - "y": 1 - }, - "o": { - "x": 0.05, - "y": 0.7 - }, + "i": { "x": 0.1, "y": 1 }, + "o": { "x": 0.05, "y": 0.7 }, "t": 125, - "s": [ - 412, - 190.6, - 0 - ], - "to": [ - 0, - 0, - 0 - ], - "ti": [ - 0, - 5.757, - 0 - ] + "s": [412, 190.6, 0], + "to": [0, 0, 0], + "ti": [0, 5.757, 0] }, { + "i": { "x": 0.99, "y": 0.99 }, + "o": { "x": 0.01, "y": 0.01 }, "t": 150, - "s": [ - 412, - 154, - 0 - ] - } + "s": [412, 154, 0], + "to": [0, 0, 0], + "ti": [0, 0, 0] + }, + { + "i": { "x": 0.8, "y": 0.15 }, + "o": { "x": 0.3, "y": 0 }, + "t": 210, + "s": [412, 154, 0], + "to": [0, 0.203, 0], + "ti": [0, 0, 0] + }, + { + "i": { "x": 0.1, "y": 1 }, + "o": { "x": 0.05, "y": 0.7 }, + "t": 215, + "s": [412, 178.4, 0], + "to": [0, 0, 0], + "ti": [0, -0.588, 0] + }, + { + "i": { "x": 0.833, "y": 0.833 }, + "o": { "x": 0.167, "y": 0.167 }, + "t": 240, + "s": [412, 215, 0], + "to": [0, 0, 0], + "ti": [0, 0, 0] + }, + { + "i": { "x": 0.8, "y": 0.15 }, + "o": { "x": 0.3, "y": 0 }, + "t": 300, + "s": [412, 215, 0], + "to": [0, -0.609, 0], + "ti": [0, 0, 0] + }, + { + "i": { "x": 0.1, "y": 1 }, + "o": { "x": 0.05, "y": 0.7 }, + "t": 305, + "s": [412, 190.6, 0], + "to": [0, 0, 0], + "ti": [0, 5.757, 0] + }, + { "t": 330, "s": [412, 154, 0] } ], "ix": 2, "l": 2 }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.8, - 0.8, - 0.8 - ], - "y": [ - 0.15, - 0.15, - 1 - ] - }, - "o": { - "x": [ - 0.3, - 0.3, - 0.3 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.8, 0.8, 0.8], "y": [0.15, 0.15, 1] }, + "o": { "x": [0.3, 0.3, 0.3], "y": [0, 0, 0] }, "t": 30, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.1, - 0.1, - 0.1 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.05, - 0.05, - 0.05 - ], - "y": [ - 0.7, - 0.7, - 0 - ] - }, + "i": { "x": [0.1, 0.1, 0.1], "y": [1, 1, 1] }, + "o": { "x": [0.05, 0.05, 0.05], "y": [0.7, 0.7, 0] }, "t": 35, - "s": [ - 79.2, - 79.2, - 100 - ] + "s": [79.2, 79.2, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 60, - "s": [ - 48, - 48, - 100 - ] + "s": [48, 48, 100] }, { - "i": { - "x": [ - 0.8, - 0.8, - 0.8 - ], - "y": [ - 0.15, - 0.15, - 1 - ] - }, - "o": { - "x": [ - 0.3, - 0.3, - 0.3 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.8, 0.8, 0.8], "y": [0.15, 0.15, 1] }, + "o": { "x": [0.3, 0.3, 0.3], "y": [0, 0, 0] }, "t": 120, - "s": [ - 48, - 48, - 100 - ] + "s": [48, 48, 100] }, { - "i": { - "x": [ - 0.1, - 0.1, - 0.1 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.05, - 0.05, - 0.05 - ], - "y": [ - 0.7, - 0.7, - 0 - ] - }, + "i": { "x": [0.1, 0.1, 0.1], "y": [1, 1, 1] }, + "o": { "x": [0.05, 0.05, 0.05], "y": [0.7, 0.7, 0] }, "t": 125, - "s": [ - 68.8, - 68.8, - 100 - ] + "s": [68.8, 68.8, 100] }, { + "i": { "x": [0.99, 0.99, 0.99], "y": [1, 1, 1] }, + "o": { "x": [0.01, 0.01, 0.01], "y": [0, 0, 0] }, "t": 150, - "s": [ - 100, - 100, - 100 - ] - } + "s": [100, 100, 100] + }, + { + "i": { "x": [0.8, 0.8, 0.8], "y": [0.15, 0.15, 1] }, + "o": { "x": [0.3, 0.3, 0.3], "y": [0, 0, 0] }, + "t": 210, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.1, 0.1, 0.1], "y": [1, 1, 1] }, + "o": { "x": [0.05, 0.05, 0.05], "y": [0.7, 0.7, 0] }, + "t": 215, + "s": [79.2, 79.2, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 240, + "s": [48, 48, 100] + }, + { + "i": { "x": [0.8, 0.8, 0.8], "y": [0.15, 0.15, 1] }, + "o": { "x": [0.3, 0.3, 0.3], "y": [0, 0, 0] }, + "t": 300, + "s": [48, 48, 100] + }, + { + "i": { "x": [0.1, 0.1, 0.1], "y": [1, 1, 1] }, + "o": { "x": [0.05, 0.05, 0.05], "y": [0.7, 0.7, 0] }, + "t": 305, + "s": [68.8, 68.8, 100] + }, + { "t": 330, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -372,46 +205,11 @@ "parent": 3, "sr": 1, "ks": { - "o": { - "a": 0, - "k": 100, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - -3, - -1, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, - "s": { - "a": 0, - "k": [ - 100, - 100, - 100 - ], - "ix": 6, - "l": 2 - } + "o": { "a": 0, "k": 100, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [-3, -1, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6, "l": 2 } }, "ao": 0, "shapes": [ @@ -426,130 +224,40 @@ "a": 0, "k": { "i": [ - [ - -12.194, - 8.13 - ], - [ - -14.642, - -0.049 - ], - [ - -13.858, - -13.91 - ], - [ - 0, - -19.64 - ], - [ - 8.129, - -12.146 - ], - [ - 13.516, - -5.632 - ], - [ - 14.348, - 2.841 - ], - [ - 10.333, - 10.334 - ], - [ - 2.889, - 14.35 - ], - [ - -5.583, - 13.518 - ] + [-12.194, 8.13], + [-14.642, -0.049], + [-13.858, -13.91], + [0, -19.64], + [8.129, -12.146], + [13.516, -5.632], + [14.348, 2.841], + [10.333, 10.334], + [2.889, 14.35], + [-5.583, 13.518] ], "o": [ - [ - 12.194, - -8.13 - ], - [ - 19.637, - 0 - ], - [ - 13.858, - 13.861 - ], - [ - 0, - 14.595 - ], - [ - -8.129, - 12.195 - ], - [ - -13.516, - 5.583 - ], - [ - -14.348, - -2.89 - ], - [ - -10.333, - -10.383 - ], - [ - -2.889, - -14.35 - ], - [ - 5.583, - -13.518 - ] + [12.194, -8.13], + [19.637, 0], + [13.858, 13.861], + [0, 14.595], + [-8.129, 12.195], + [-13.516, 5.583], + [-14.348, -2.89], + [-10.333, -10.383], + [-2.889, -14.35], + [5.583, -13.518] ], "v": [ - [ - -41.079, - -61.559 - ], - [ - 0.055, - -74 - ], - [ - 52.355, - -52.303 - ], - [ - 74, - 0.005 - ], - [ - 61.513, - 41.097 - ], - [ - 28.311, - 68.377 - ], - [ - -14.44, - 72.589 - ], - [ - -52.343, - 52.313 - ], - [ - -72.567, - 14.404 - ], - [ - -68.356, - -28.353 - ] + [-41.079, -61.559], + [0.055, -74], + [52.355, -52.303], + [74, 0.005], + [61.513, 41.097], + [28.311, 68.377], + [-14.44, 72.589], + [-52.343, 52.313], + [-72.567, 14.404], + [-68.356, -28.353] ], "c": true }, @@ -567,154 +275,46 @@ "a": 0, "k": { "i": [ - [ - 1.322, - 1.469 - ], - [ - 1.959, - 0.147 - ], - [ - 1.028, - -0.343 - ], - [ - 0.784, - -0.735 - ], - [ - 0.441, - -0.98 - ], - [ - 0, - -1.077 - ], - [ - -0.441, - -0.98 - ], - [ - -0.784, - -0.735 - ], - [ - -1.028, - -0.343 - ], - [ - -1.077, - 0.049 - ], - [ - -1.322, - 1.42 - ], - [ - 0, - 1.959 - ] + [1.322, 1.469], + [1.959, 0.147], + [1.028, -0.343], + [0.784, -0.735], + [0.441, -0.98], + [0, -1.077], + [-0.441, -0.98], + [-0.784, -0.735], + [-1.028, -0.343], + [-1.077, 0.049], + [-1.322, 1.42], + [0, 1.959] ], "o": [ - [ - -1.322, - -1.42 - ], - [ - -1.077, - -0.098 - ], - [ - -1.028, - 0.343 - ], - [ - -0.784, - 0.735 - ], - [ - -0.392, - 0.98 - ], - [ - 0, - 1.077 - ], - [ - 0.441, - 0.98 - ], - [ - 0.784, - 0.735 - ], - [ - 1.028, - 0.392 - ], - [ - 1.959, - -0.196 - ], - [ - 1.322, - -1.42 - ], - [ - 0, - -1.959 - ] + [-1.322, -1.42], + [-1.077, -0.098], + [-1.028, 0.343], + [-0.784, 0.735], + [-0.392, 0.98], + [0, 1.077], + [0.441, 0.98], + [0.784, 0.735], + [1.028, 0.392], + [1.959, -0.196], + [1.322, -1.42], + [0, -1.959] ], "v": [ - [ - 5.148, - -35.895 - ], - [ - 0.055, - -38.344 - ], - [ - -3.128, - -37.952 - ], - [ - -5.87, - -36.336 - ], - [ - -7.731, - -33.741 - ], - [ - -8.367, - -30.605 - ], - [ - -7.731, - -27.471 - ], - [ - -5.87, - -24.875 - ], - [ - -3.128, - -23.259 - ], - [ - 0.055, - -22.819 - ], - [ - 5.148, - -25.317 - ], - [ - 7.205, - -30.605 - ] + [5.148, -35.895], + [0.055, -38.344], + [-3.128, -37.952], + [-5.87, -36.336], + [-7.731, -33.741], + [-8.367, -30.605], + [-7.731, -27.471], + [-5.87, -24.875], + [-3.128, -23.259], + [0.055, -22.819], + [5.148, -25.317], + [7.205, -30.605] ], "c": true }, @@ -732,166 +332,49 @@ "a": 0, "k": { "i": [ - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - -7.688, - 1.959 - ], - [ - 0, - 0 - ], - [ - 21.645, - 5.143 - ], - [ - 0, - 0 - ], - [ - -7.835, - -0.637 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ] + [0, 0], + [0, 0], + [0, 0], + [-7.688, 1.959], + [0, 0], + [21.645, 5.143], + [0, 0], + [-7.835, -0.637], + [0, 0], + [0, 0], + [0, 0], + [0, 0], + [0, 0] ], "o": [ - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 7.933, - -0.588 - ], - [ - 0, - 0 - ], - [ - -21.645, - 5.143 - ], - [ - 0, - 0 - ], - [ - 7.639, - 1.959 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ] + [0, 0], + [0, 0], + [7.933, -0.588], + [0, 0], + [-21.645, 5.143], + [0, 0], + [7.639, 1.959], + [0, 0], + [0, 0], + [0, 0], + [0, 0], + [0, 0], + [0, 0] ], "v": [ - [ - 11.661, - 39.187 - ], - [ - 11.661, - -11.211 - ], - [ - 11.465, - -11.211 - ], - [ - 34.922, - -15.08 - ], - [ - 33.012, - -22.819 - ], - [ - -32.901, - -22.819 - ], - [ - -34.86, - -15.08 - ], - [ - -11.6, - -11.211 - ], - [ - -11.6, - 39.138 - ], - [ - -3.862, - 39.138 - ], - [ - -3.862, - 15.874 - ], - [ - 3.924, - 15.874 - ], - [ - 3.924, - 39.187 - ] + [11.661, 39.187], + [11.661, -11.211], + [11.465, -11.211], + [34.922, -15.08], + [33.012, -22.819], + [-32.901, -22.819], + [-34.86, -15.08], + [-11.6, -11.211], + [-11.6, 39.138], + [-3.862, 39.138], + [-3.862, 15.874], + [3.924, 15.874], + [3.924, 39.187] ], "c": true }, @@ -905,19 +388,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.909803921569, - 0.917647058824, - 0.929411764706, - 1 - ], + "k": [0.909803921569, 0.917647058824, 0.929411764706, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -926,50 +400,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -997,46 +434,11 @@ "parent": 1, "sr": 1, "ks": { - "o": { - "a": 0, - "k": 100, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 98, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, - "s": { - "a": 0, - "k": [ - 100, - 100, - 100 - ], - "ix": 6, - "l": 2 - } + "o": { "a": 0, "k": 100, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [0, 0, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [98, 0, 0], "ix": 1, "l": 2 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6, "l": 2 } }, "ao": 0, "shapes": [ @@ -1051,94 +453,31 @@ "a": 0, "k": { "i": [ - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 17.884, - 17.997 - ], - [ - 0, - 25.479 - ], - [ - -17.884, - 17.997 - ], - [ - -25.32, - 0 - ], - [ - 0, - 0 - ] + [0, 0], + [0, 0], + [17.884, 17.997], + [0, 25.479], + [-17.884, 17.997], + [-25.32, 0], + [0, 0] ], "o": [ - [ - 0, - 0 - ], - [ - -25.32, - 0 - ], - [ - -17.884, - -17.997 - ], - [ - 0, - -25.479 - ], - [ - 17.884, - -18.046 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ] + [0, 0], + [-25.32, 0], + [-17.884, -17.997], + [0, -25.479], + [17.884, -18.046], + [0, 0], + [0, 0] ], "v": [ - [ - 98, - 96 - ], - [ - -2.6, - 96 - ], - [ - -70.056, - 67.88 - ], - [ - -98, - 0.001 - ], - [ - -70.056, - -67.88 - ], - [ - -2.6, - -96 - ], - [ - 98, - -96 - ] + [98, 96], + [-2.6, 96], + [-70.056, 67.88], + [-98, 0.001], + [-70.056, -67.88], + [-2.6, -96], + [98, -96] ], "c": false }, @@ -1152,24 +491,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.909803921569, - 0.917647058824, - 0.929411764706, - 1 - ], + "k": [0.909803921569, 0.917647058824, 0.929411764706, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 4, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 4, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -1180,50 +506,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -1250,46 +539,11 @@ "cl": "black", "sr": 1, "ks": { - "o": { - "a": 0, - "k": 100, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206, - 150, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, - "s": { - "a": 0, - "k": [ - 100, - 100, - 100 - ], - "ix": 6, - "l": 2 - } + "o": { "a": 0, "k": 100, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206, 150, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6, "l": 2 } }, "ao": 0, "shapes": [ @@ -1304,106 +558,34 @@ "a": 0, "k": { "i": [ - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.5 - ], - [ - 0, - 0 - ], - [ - 15.2, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ] + [-15.3, 0], + [0, 0], + [0, 15.5], + [0, 0], + [15.2, 0], + [0, 0], + [0, -15.7], + [0, 0] ], "o": [ - [ - 0, - 0 - ], - [ - 15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ], - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.7 - ] + [0, 0], + [15.3, 0], + [0, 0], + [0, -15.7], + [0, 0], + [-15.3, 0], + [0, 0], + [0, 15.7] ], "v": [ - [ - -178.2, - 150 - ], - [ - 178.2, - 150 - ], - [ - 206, - 121.7 - ], - [ - 206, - -121.5 - ], - [ - 178.3, - -150 - ], - [ - -178.2, - -150 - ], - [ - -206, - -121.5 - ], - [ - -206, - 121.5 - ] + [-178.2, 150], + [178.2, 150], + [206, 121.7], + [206, -121.5], + [178.3, -150], + [-178.2, -150], + [-206, -121.5], + [-206, 121.5] ], "c": true }, @@ -1415,21 +597,8 @@ }, { "ty": "fl", - "c": { - "a": 0, - "k": [ - 0, - 0, - 0, - 1 - ], - "ix": 4 - }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "c": { "a": 0, "k": [0, 0, 0, 1], "ix": 4 }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -1438,50 +607,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -1503,4 +635,4 @@ ], "markers": [], "props": {} -} \ No newline at end of file +} diff --git a/res/raw/accessibility_shortcut_type_tripletap.json b/res/raw/accessibility_shortcut_type_tripletap.json index 18f1736ae17..c74c66b8268 100644 --- a/res/raw/accessibility_shortcut_type_tripletap.json +++ b/res/raw/accessibility_shortcut_type_tripletap.json @@ -2,10 +2,10 @@ "v": "5.12.1", "fr": 60, "ip": 0, - "op": 135, + "op": 126, "w": 412, "h": 300, - "nm": "Accessibility_Triple_Tap_v5_export", + "nm": "Accessibility_Triple_Tap_v5_export 2", "ddd": 0, "assets": [], "layers": [ @@ -21,644 +21,274 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 1.832, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 9.623, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 11.91, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 16.543, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 18.377, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 26.164, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 28.457, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 33.09, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 34.922, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 42.711, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 45, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 85, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 86.832, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 94.623, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 96.91, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 101.543, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 103.377, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 111.164, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 113.457, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 118.09, + "s": [0] + }, + { "t": 119.921875, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206.01, - 150.01, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206.01, 150.01, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0, - "s": [ - 120, - 120, - 100 - ] + "s": [120, 120, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 5.498, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 7.328, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 11.91, - "s": [ - 120, - 120, - 100 - ] + "s": [120, 120, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 16.543, - "s": [ - 120, - 120, - 100 - ] + "s": [120, 120, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 22.043, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 23.873, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 28.457, - "s": [ - 120, - 120, - 100 - ] + "s": [120, 120, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 33.09, - "s": [ - 120, - 120, - 100 - ] + "s": [120, 120, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 38.588, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 40.418, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 45, - "s": [ - 120, - 120, - 100 - ] - } + "s": [120, 120, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 85, + "s": [120, 120, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 90.498, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 92.328, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 96.91, + "s": [120, 120, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 101.543, + "s": [120, 120, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 107.043, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 108.873, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 113.457, + "s": [120, 120, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 118.09, + "s": [120, 120, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 123.588, + "s": [100, 100, 100] + }, + { "t": 125.41796875, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -677,58 +307,22 @@ "a": 0, "k": { "i": [ - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ], - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ] + [-20.621, 0], + [0, 20.621], + [20.621, 0], + [0, -20.621] ], "o": [ - [ - 20.621, - 0 - ], - [ - 0, - -20.621 - ], - [ - -20.621, - 0 - ], - [ - 0, - 20.621 - ] + [20.621, 0], + [0, -20.621], + [-20.621, 0], + [0, 20.621] ], "v": [ - [ - 0, - 37.338 - ], - [ - 37.338, - 0 - ], - [ - 0, - -37.338 - ], - [ - -37.338, - 0 - ] + [0, 37.338], + [37.338, 0], + [0, -37.338], + [-37.338, 0] ], "c": true }, @@ -742,24 +336,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -772,19 +353,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -793,50 +365,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -867,644 +402,274 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 1.832, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 9.623, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 11.91, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 16.543, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 18.377, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 26.164, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 28.457, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 33.09, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 34.922, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 42.711, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 45, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 85, + "s": [1] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 86.832, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 94.623, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 96.91, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 101.543, + "s": [1] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 103.377, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 111.164, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 113.457, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 118.09, + "s": [1] + }, + { "t": 119.921875, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206.012, - 150.012, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206.012, 150.012, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0, - "s": [ - 80, - 80, - 100 - ] + "s": [80, 80, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 5.498, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 7.328, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 11.91, - "s": [ - 80, - 80, - 100 - ] + "s": [80, 80, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 16.543, - "s": [ - 80, - 80, - 100 - ] + "s": [80, 80, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 22.043, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 23.873, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 28.457, - "s": [ - 80, - 80, - 100 - ] + "s": [80, 80, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 33.09, - "s": [ - 80, - 80, - 100 - ] + "s": [80, 80, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 38.588, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 40.418, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 45, - "s": [ - 80, - 80, - 100 - ] - } + "s": [80, 80, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 85, + "s": [80, 80, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 90.498, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 92.328, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 96.91, + "s": [80, 80, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 101.543, + "s": [80, 80, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 107.043, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 108.873, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 113.457, + "s": [80, 80, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 118.09, + "s": [80, 80, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 123.588, + "s": [100, 100, 100] + }, + { "t": 125.41796875, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -1523,58 +688,22 @@ "a": 0, "k": { "i": [ - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ], - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ] + [-31.444, 0], + [0, 31.444], + [31.444, 0], + [0, -31.444] ], "o": [ - [ - 31.444, - 0 - ], - [ - 0, - -31.444 - ], - [ - -31.444, - 0 - ], - [ - 0, - 31.444 - ] + [31.444, 0], + [0, -31.444], + [-31.444, 0], + [0, 31.444] ], "v": [ - [ - 0, - 56.934 - ], - [ - 56.934, - 0 - ], - [ - 0, - -56.934 - ], - [ - -56.934, - 0 - ] + [0, 56.934], + [56.934, 0], + [0, -56.934], + [-56.934, 0] ], "c": true }, @@ -1588,24 +717,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -1618,19 +734,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -1639,50 +746,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -1713,644 +783,274 @@ "a": 1, "k": [ { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 0, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 1.832, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 9.623, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 11.91, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 16.543, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 18.377, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 26.164, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 28.457, - "s": [ - 0 - ] + "s": [0] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 33.09, - "s": [ - 1 - ] + "s": [1] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 34.922, - "s": [ - 50 - ] + "s": [50] }, { - "i": { - "x": [ - 0.833 - ], - "y": [ - 0.833 - ] - }, - "o": { - "x": [ - 0.167 - ], - "y": [ - 0.167 - ] - }, + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 42.711, - "s": [ - 50 - ] + "s": [50] }, { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, "t": 45, - "s": [ - 0 - ] - } + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 85, + "s": [1] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 86.832, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 94.623, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 96.91, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 101.543, + "s": [1] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 103.377, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 111.164, + "s": [50] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 113.457, + "s": [0] + }, + { + "i": { "x": [0.833], "y": [0.833] }, + "o": { "x": [0.167], "y": [0.167] }, + "t": 118.09, + "s": [1] + }, + { "t": 119.921875, "s": [50] } ], "ix": 11 }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206, - 150, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206, 150, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, "s": { "a": 1, "k": [ { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 0, - "s": [ - 60, - 60, - 100 - ] + "s": [60, 60, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 5.498, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 7.328, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 11.91, - "s": [ - 60, - 60, - 100 - ] + "s": [60, 60, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 16.543, - "s": [ - 60, - 60, - 100 - ] + "s": [60, 60, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 22.043, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 23.873, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 28.457, - "s": [ - 60, - 60, - 100 - ] + "s": [60, 60, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 33.09, - "s": [ - 60, - 60, - 100 - ] + "s": [60, 60, 100] }, { - "i": { - "x": [ - 0.833, - 0.833, - 0.833 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.333, - 0.333, - 0.333 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, "t": 38.588, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { - "i": { - "x": [ - 0.667, - 0.667, - 0.667 - ], - "y": [ - 1, - 1, - 1 - ] - }, - "o": { - "x": [ - 0.167, - 0.167, - 0.167 - ], - "y": [ - 0, - 0, - 0 - ] - }, + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 40.418, - "s": [ - 100, - 100, - 100 - ] + "s": [100, 100, 100] }, { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, "t": 45, - "s": [ - 60, - 60, - 100 - ] - } + "s": [60, 60, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 85, + "s": [60, 60, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 90.498, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 92.328, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 96.91, + "s": [60, 60, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 101.543, + "s": [60, 60, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 107.043, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 108.873, + "s": [100, 100, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.167, 0.167, 0.167], "y": [0, 0, 0] }, + "t": 113.457, + "s": [60, 60, 100] + }, + { + "i": { "x": [0.667, 0.667, 0.667], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 118.09, + "s": [60, 60, 100] + }, + { + "i": { "x": [0.833, 0.833, 0.833], "y": [1, 1, 1] }, + "o": { "x": [0.333, 0.333, 0.333], "y": [0, 0, 0] }, + "t": 123.588, + "s": [100, 100, 100] + }, + { "t": 125.41796875, "s": [100, 100, 100] } ], "ix": 6, "l": 2 @@ -2369,58 +1069,22 @@ "a": 0, "k": { "i": [ - [ - -41.974, - 0 - ], - [ - 0, - 41.974 - ], - [ - 41.974, - 0 - ], - [ - 0, - -41.974 - ] + [-41.974, 0], + [0, 41.974], + [41.974, 0], + [0, -41.974] ], "o": [ - [ - 41.974, - 0 - ], - [ - 0, - -41.974 - ], - [ - -41.974, - 0 - ], - [ - 0, - 41.974 - ] + [41.974, 0], + [0, -41.974], + [-41.974, 0], + [0, 41.974] ], "v": [ - [ - 0, - 76 - ], - [ - 76, - 0 - ], - [ - 0, - -76 - ], - [ - -76, - 0 - ] + [0, 76], + [76, 0], + [0, -76], + [-76, 0] ], "c": true }, @@ -2434,24 +1098,11 @@ "ty": "st", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 3 }, - "o": { - "a": 0, - "k": 100, - "ix": 4 - }, - "w": { - "a": 0, - "k": 2.764, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 2.764, "ix": 5 }, "lc": 1, "lj": 1, "ml": 4, @@ -2464,19 +1115,10 @@ "ty": "fl", "c": { "a": 0, - "k": [ - 0.40000000596, - 0.615686297417, - 0.964705884457, - 1 - ], + "k": [0.40000000596, 0.615686297417, 0.964705884457, 1], "ix": 4 }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -2485,50 +1127,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -2555,46 +1160,11 @@ "cl": "black", "sr": 1, "ks": { - "o": { - "a": 0, - "k": 100, - "ix": 11 - }, - "r": { - "a": 0, - "k": 0, - "ix": 10 - }, - "p": { - "a": 0, - "k": [ - 206, - 150, - 0 - ], - "ix": 2, - "l": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0, - 0 - ], - "ix": 1, - "l": 2 - }, - "s": { - "a": 0, - "k": [ - 100, - 100, - 100 - ], - "ix": 6, - "l": 2 - } + "o": { "a": 0, "k": 100, "ix": 11 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "p": { "a": 0, "k": [206, 150, 0], "ix": 2, "l": 2 }, + "a": { "a": 0, "k": [0, 0, 0], "ix": 1, "l": 2 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6, "l": 2 } }, "ao": 0, "shapes": [ @@ -2609,106 +1179,34 @@ "a": 0, "k": { "i": [ - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.5 - ], - [ - 0, - 0 - ], - [ - 15.2, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ] + [-15.3, 0], + [0, 0], + [0, 15.5], + [0, 0], + [15.2, 0], + [0, 0], + [0, -15.7], + [0, 0] ], "o": [ - [ - 0, - 0 - ], - [ - 15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -15.7 - ], - [ - 0, - 0 - ], - [ - -15.3, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 15.7 - ] + [0, 0], + [15.3, 0], + [0, 0], + [0, -15.7], + [0, 0], + [-15.3, 0], + [0, 0], + [0, 15.7] ], "v": [ - [ - -178.2, - 150 - ], - [ - 178.2, - 150 - ], - [ - 206, - 121.7 - ], - [ - 206, - -121.5 - ], - [ - 178.3, - -150 - ], - [ - -178.2, - -150 - ], - [ - -206, - -121.5 - ], - [ - -206, - 121.5 - ] + [-178.2, 150], + [178.2, 150], + [206, 121.7], + [206, -121.5], + [178.3, -150], + [-178.2, -150], + [-206, -121.5], + [-206, 121.5] ], "c": true }, @@ -2720,21 +1218,8 @@ }, { "ty": "fl", - "c": { - "a": 0, - "k": [ - 0, - 0, - 0, - 1 - ], - "ix": 4 - }, - "o": { - "a": 0, - "k": 100, - "ix": 5 - }, + "c": { "a": 0, "k": [0, 0, 0, 1], "ix": 4 }, + "o": { "a": 0, "k": 100, "ix": 5 }, "r": 1, "bm": 0, "nm": "Fill 1", @@ -2743,50 +1228,13 @@ }, { "ty": "tr", - "p": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 2 - }, - "a": { - "a": 0, - "k": [ - 0, - 0 - ], - "ix": 1 - }, - "s": { - "a": 0, - "k": [ - 100, - 100 - ], - "ix": 3 - }, - "r": { - "a": 0, - "k": 0, - "ix": 6 - }, - "o": { - "a": 0, - "k": 100, - "ix": 7 - }, - "sk": { - "a": 0, - "k": 0, - "ix": 4 - }, - "sa": { - "a": 0, - "k": 0, - "ix": 5 - }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "o": { "a": 0, "k": 100, "ix": 7 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, "nm": "Transform" } ], @@ -2806,12 +1254,6 @@ "bm": 0 } ], - "markers": [ - { - "tm": 135, - "cm": "1", - "dr": 0 - } - ], + "markers": [{ "tm": 211, "cm": "1", "dr": 0 }], "props": {} -} \ No newline at end of file +} diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java b/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java index c613181d489..37b644b5598 100644 --- a/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java +++ b/src/com/android/settings/accessibility/AccessibilityShortcutsTutorial.java @@ -72,7 +72,6 @@ import com.android.settingslib.utils.StringUtil; import com.android.settingslib.widget.LottieColorUtils; import com.airbnb.lottie.LottieAnimationView; -import com.airbnb.lottie.LottieDrawable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -335,7 +334,8 @@ public final class AccessibilityShortcutsTutorial { result -> Log.w(TAG, "Invalid image raw resource id: " + imageRawRes, result)); lottieView.setAnimation(imageRawRes); - lottieView.setRepeatCount(LottieDrawable.INFINITE); + // Follow the Motion Stoppable requirement by using a finite animation. + lottieView.setRepeatCount(0); LottieColorUtils.applyDynamicColors(context, lottieView); lottieView.playAnimation(); diff --git a/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreference.java b/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreference.java index 26855d55bd3..7b61d935e7d 100644 --- a/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreference.java +++ b/src/com/android/settings/accessibility/shortcuts/ShortcutOptionPreference.java @@ -35,7 +35,6 @@ import com.android.settings.R; import com.android.settingslib.widget.LottieColorUtils; import com.airbnb.lottie.LottieAnimationView; -import com.airbnb.lottie.LottieDrawable; /** * A preference represents an accessibility shortcut option with a checkbox and a tutorial image @@ -96,7 +95,8 @@ public class ShortcutOptionPreference extends CheckBoxPreference { .getResourceEntryName(mIntroImageRawResId), result)); imageView.setAnimation(mIntroImageRawResId); - imageView.setRepeatCount(LottieDrawable.INFINITE); + // Follow the Motion Stoppable requirement by using a finite animation. + imageView.setRepeatCount(0); LottieColorUtils.applyDynamicColors(imageView.getContext(), imageView); imageView.playAnimation(); } else { From f0e06b6cab938a2e1a3f222475719eceb64b4bb0 Mon Sep 17 00:00:00 2001 From: tomhsu Date: Wed, 4 Dec 2024 05:47:42 +0000 Subject: [PATCH 22/23] Fix crash due to resource not found. Flag: EXEMPT bug fix Fix: b/382071330 Test: atest pass. Change-Id: I18ddeea7a9d077444838f39b07ffb2ebc5eb974d --- ...telliteSettingsSosFooterPreferenceControllerTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsSosFooterPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsSosFooterPreferenceControllerTest.java index 7aa6535962d..498ebced6b0 100644 --- a/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsSosFooterPreferenceControllerTest.java +++ b/tests/unit/src/com/android/settings/network/telephony/SatelliteSettingsSosFooterPreferenceControllerTest.java @@ -19,6 +19,7 @@ package com.android.settings.network.telephony; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import android.content.Context; import android.os.Looper; @@ -32,6 +33,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; @@ -42,8 +44,10 @@ public class SatelliteSettingsSosFooterPreferenceControllerTest { @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule(); - private Context mContext = null; + @Mock private FooterPreference mFooterPreference; + + private Context mContext = null; private SatelliteSettingsSosFooterPreferenceController mController; @Before @@ -52,8 +56,7 @@ public class SatelliteSettingsSosFooterPreferenceControllerTest { Looper.prepare(); } mContext = spy(ApplicationProvider.getApplicationContext()); - mFooterPreference = spy(new FooterPreference(mContext)); - mFooterPreference.setKey(KEY); + when(mFooterPreference.getKey()).thenReturn(KEY); mController = new SatelliteSettingsSosFooterPreferenceController(mContext, KEY); } From 8839335d58b385a0b252126b90c9794ff63a08f1 Mon Sep 17 00:00:00 2001 From: David Magno Date: Tue, 23 Apr 2024 18:08:11 +0200 Subject: [PATCH 23/23] Customize the availability of Testing Settings Menu Add the possibility to disable the Testing Settings Menu (secret code *#*#4636#*#*) on user builds. Bug: 306338055 Test: atest TestingSettingsBroadcastReceiverTest Flag: NA No-Typo-Check: trivial Change-Id: I451f094864bd9a0ad8086e9646e2d666ab2388dc --- res/values/config.xml | 3 + .../TestingSettingsBroadcastReceiver.java | 9 ++- .../TestingSettingsBroadcastReceiverTest.java | 69 +++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/res/values/config.xml b/res/values/config.xml index 0d7f2319415..7d124ec0479 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -842,4 +842,7 @@ com.android.virtualization.terminal + + + false diff --git a/src/com/android/settings/TestingSettingsBroadcastReceiver.java b/src/com/android/settings/TestingSettingsBroadcastReceiver.java index 30a0d796c1c..9965630ea1b 100644 --- a/src/com/android/settings/TestingSettingsBroadcastReceiver.java +++ b/src/com/android/settings/TestingSettingsBroadcastReceiver.java @@ -19,6 +19,7 @@ package com.android.settings; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.os.Build; import android.telephony.TelephonyManager; import com.android.settings.Settings.TestingSettingsActivity; @@ -32,11 +33,17 @@ public class TestingSettingsBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent != null && intent.getAction() != null - && intent.getAction().equals(TelephonyManager.ACTION_SECRET_CODE)) { + && intent.getAction().equals(TelephonyManager.ACTION_SECRET_CODE) + && !isDisabled(context)) { Intent i = new Intent(Intent.ACTION_MAIN); i.setClass(context, TestingSettingsActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } + + private boolean isDisabled(Context context) { + return "user".equals(Build.TYPE) && context.getResources().getBoolean( + R.bool.config_hide_testing_settings_menu_for_user_builds); + } } diff --git a/tests/robotests/src/com/android/settings/TestingSettingsBroadcastReceiverTest.java b/tests/robotests/src/com/android/settings/TestingSettingsBroadcastReceiverTest.java index 10fdffbc3ed..eb51ae87876 100644 --- a/tests/robotests/src/com/android/settings/TestingSettingsBroadcastReceiverTest.java +++ b/tests/robotests/src/com/android/settings/TestingSettingsBroadcastReceiverTest.java @@ -18,9 +18,13 @@ package com.android.settings; import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import android.app.Application; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.telephony.TelephonyManager; import org.junit.Before; @@ -29,6 +33,7 @@ import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.Shadows; +import org.robolectric.shadows.ShadowBuild; @RunWith(RobolectricTestRunner.class) public class TestingSettingsBroadcastReceiverTest { @@ -78,4 +83,68 @@ public class TestingSettingsBroadcastReceiverTest { final String dest = next.getComponent().getClassName(); assertThat(dest).isEqualTo(Settings.TestingSettingsActivity.class.getName()); } + + @Test + public void onReceive_disabledForUserBuild_BuildType_User_shouldNotStartActivity() { + // TestingSettingsMenu should be disabled if current Build.TYPE is "user" and + // 'config_hide_testing_settings_menu_for_user_builds' is true + ShadowBuild.setType("user"); + + mContext = spy(RuntimeEnvironment.application); + setUpConfig(mContext, true /*disable for user build*/); + + final Intent intent = new Intent(); + intent.setAction(TelephonyManager.ACTION_SECRET_CODE); + + mReceiver.onReceive(mContext, intent); + + final Intent next = Shadows.shadowOf(mApplication).getNextStartedActivity(); + assertThat(next).isNull(); + } + + @Test + public void onReceive_disabledForUserBuild_BuildType_Userdebug_shouldStartActivity() { + // TestingSettingsMenu should not be disabled if current Build.TYPE is "userdebug" and + // 'config_hide_testing_settings_menu_for_user_builds' is true + ShadowBuild.setType("userdebug"); + + mContext = spy(RuntimeEnvironment.application); + setUpConfig(mContext, true /*disable for user build*/); + + final Intent intent = new Intent(); + intent.setAction(TelephonyManager.ACTION_SECRET_CODE); + + mReceiver.onReceive(mContext, intent); + + final Intent next = Shadows.shadowOf(mApplication).getNextStartedActivity(); + assertThat(next).isNotNull(); + final String dest = next.getComponent().getClassName(); + assertThat(dest).isEqualTo(Settings.TestingSettingsActivity.class.getName()); + } + + @Test + public void onReceive_notDisabledForUserBuildType_shouldStartActivity() { + // TestingSettingsMenu should not be disabled if + // 'config_hide_testing_settings_menu_for_user_builds' is false, regardless of Build.TYPE + mContext = spy(RuntimeEnvironment.application); + setUpConfig(mContext, false /*disable for user build*/); + + final Intent intent = new Intent(); + intent.setAction(TelephonyManager.ACTION_SECRET_CODE); + + mReceiver.onReceive(mContext, intent); + + final Intent next = Shadows.shadowOf(mApplication).getNextStartedActivity(); + assertThat(next).isNotNull(); + final String dest = next.getComponent().getClassName(); + assertThat(dest).isEqualTo(Settings.TestingSettingsActivity.class.getName()); + } + + private static void setUpConfig(Context context, boolean disabledForUserBuild) { + when(context.getApplicationContext()).thenReturn(context); + Resources spiedResources = spy(context.getResources()); + when(context.getResources()).thenReturn(spiedResources); + when(spiedResources.getBoolean(R.bool.config_hide_testing_settings_menu_for_user_builds)) + .thenReturn(disabledForUserBuild); + } }