Loading res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -113,4 +113,6 @@ <!-- Class name for the storage manager's deletion helper class. --> <string name="config_deletion_helper_class" translatable="false">com.android.storagemanager.deletionhelper.DeletionHelperActivity</string> <!-- Whether or not new device intro suggestion is supported for this device --> <bool name="config_new_device_intro_suggestion_supported">false</bool> </resources> src/com/android/settings/support/NewDeviceIntroSuggestionActivity.java +10 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import com.android.settings.R; import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider; import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.SupportFeatureProvider; Loading Loading @@ -61,7 +62,15 @@ public class NewDeviceIntroSuggestionActivity extends Activity { } public static boolean isSuggestionComplete(Context context) { return isExpired(context) || hasLaunchedBefore(context) || !canOpenUrlInBrowser(context); return !isSupported(context) || isExpired(context) || hasLaunchedBefore(context) || !canOpenUrlInBrowser(context); } private static boolean isSupported(Context context) { return context.getResources() .getBoolean(R.bool.config_new_device_intro_suggestion_supported); } private static boolean isExpired(Context context) { Loading tests/robotests/res/values/config.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 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. --> <resources> <!-- Whether or not new device intro suggestion is supported for this device --> <bool name="config_new_device_intro_suggestion_supported">true</bool> </resources> No newline at end of file tests/robotests/src/com/android/settings/support/NewDeviceIntroSuggestionActivityTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.R; import com.android.settings.TestConfig; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.SettingsRobolectricTestRunner; import org.junit.Before; import org.junit.Test; Loading Loading @@ -69,6 +70,16 @@ public class NewDeviceIntroSuggestionActivityTest { .thenReturn(getSharedPreferences()); } @Test public void isSuggestionComplete_notSupported_shouldReturnTrue() { when(mMockContext.getResources() .getBoolean(R.bool.config_new_device_intro_suggestion_supported)) .thenReturn(false); assertThat(isSuggestionComplete(mContext)) .isTrue(); } @Test public void isSuggestionComplete_suggestionExpired_shouldReturnTrue() { final long currentTime = System.currentTimeMillis(); Loading Loading
res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -113,4 +113,6 @@ <!-- Class name for the storage manager's deletion helper class. --> <string name="config_deletion_helper_class" translatable="false">com.android.storagemanager.deletionhelper.DeletionHelperActivity</string> <!-- Whether or not new device intro suggestion is supported for this device --> <bool name="config_new_device_intro_suggestion_supported">false</bool> </resources>
src/com/android/settings/support/NewDeviceIntroSuggestionActivity.java +10 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import com.android.settings.R; import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider; import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.SupportFeatureProvider; Loading Loading @@ -61,7 +62,15 @@ public class NewDeviceIntroSuggestionActivity extends Activity { } public static boolean isSuggestionComplete(Context context) { return isExpired(context) || hasLaunchedBefore(context) || !canOpenUrlInBrowser(context); return !isSupported(context) || isExpired(context) || hasLaunchedBefore(context) || !canOpenUrlInBrowser(context); } private static boolean isSupported(Context context) { return context.getResources() .getBoolean(R.bool.config_new_device_intro_suggestion_supported); } private static boolean isExpired(Context context) { Loading
tests/robotests/res/values/config.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2017 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. --> <resources> <!-- Whether or not new device intro suggestion is supported for this device --> <bool name="config_new_device_intro_suggestion_supported">true</bool> </resources> No newline at end of file
tests/robotests/src/com/android/settings/support/NewDeviceIntroSuggestionActivityTest.java +12 −1 Original line number Diff line number Diff line Loading @@ -22,9 +22,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.R; import com.android.settings.TestConfig; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.SettingsRobolectricTestRunner; import org.junit.Before; import org.junit.Test; Loading Loading @@ -69,6 +70,16 @@ public class NewDeviceIntroSuggestionActivityTest { .thenReturn(getSharedPreferences()); } @Test public void isSuggestionComplete_notSupported_shouldReturnTrue() { when(mMockContext.getResources() .getBoolean(R.bool.config_new_device_intro_suggestion_supported)) .thenReturn(false); assertThat(isSuggestionComplete(mContext)) .isTrue(); } @Test public void isSuggestionComplete_suggestionExpired_shouldReturnTrue() { final long currentTime = System.currentTimeMillis(); Loading