</activity>
<!-- Wireless Controls -->
-
<activity android:name=".Settings$NetworkDashboardActivity"
android:taskAffinity="com.android.settings"
android:label="@string/network_dashboard_title"
android:icon="@drawable/ic_wallpaper"
android:taskAffinity="">
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
- android:value="com.android.settings.WallpaperTypeSettings" />
+ android:value="com.android.settings.wallpaper.WallpaperTypeSettings" />
</activity>
- <activity android:name="WallpaperSuggestionActivity"
+ <activity android:name=".wallpaper.WallpaperSuggestionActivity"
android:label="@string/wallpaper_settings_title"
android:icon="@drawable/ic_wallpaper"
- android:exported="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter android:priority="1">
<action android:name="android.intent.action.MAIN" />
android:value="com.android.settings.DevelopmentSettings" />
</activity-alias>
- <activity android:name=".AppPicker" android:label="@string/select_application"
- android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
+ <activity android:name=".development.AppPicker"
+ android:label="@string/select_application"
+ android:theme="@android:style/Theme.DeviceDefault.Light.Dialog" />
<activity android:name="Settings$WebViewAppPickerActivity"
android:label="@string/select_webview_provider_dialog_title">
<!-- Home application selection - uninstall button [CHAR LIMIT=80] -->
<string name="home_app_uninstall_button">Uninstall this application</string>
- <!-- Message to user that Home Settings will be hidden because there is now only one available home application -->
- <string name="only_one_home_message">Home settings will be hidden until you install another home application.</string>
<!-- Warning message when changing a global setting for a tablet.[CHAR LIMIT=none] -->
<string name="global_change_warning" product="tablet">This setting affects all users on this tablet.</string>
import android.bluetooth.BluetoothCodecStatus;
import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
-import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import com.android.internal.app.LocalePicker;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.applications.BackgroundCheckSummary;
import com.android.settings.dashboard.DashboardFeatureProvider;
-import com.android.settings.development.BugReportPreferenceController;
+import com.android.settings.development.AppPicker;
import com.android.settings.development.BugReportInPowerPreferenceController;
+import com.android.settings.development.BugReportPreferenceController;
import com.android.settings.development.TelephonyMonitorPreferenceController;
-import com.android.settings.fuelgauge.InactiveApps;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.TetherSettings;
import com.android.settings.TrustedCredentialsSettings;
import com.android.settings.UserDictionarySettings;
-import com.android.settings.WallpaperTypeSettings;
import com.android.settings.WifiCallingSettings;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.accessibility.AccessibilitySettingsForSetupWizard;
import com.android.settings.tts.TextToSpeechSettings;
import com.android.settings.users.UserSettings;
import com.android.settings.vpn2.VpnSettings;
+import com.android.settings.wallpaper.WallpaperTypeSettings;
import com.android.settings.webview.WebViewAppPicker;
import com.android.settings.wfd.WifiDisplaySettings;
import com.android.settings.wifi.ConfigureWifiSettings;
import com.android.settings.dashboard.conditional.FocusRecyclerView;
import com.android.settings.dashboard.suggestions.SuggestionDismissController;
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
+import com.android.settings.dashboard.suggestions.SuggestionsChecks;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.SuggestionParser;
import com.android.settingslib.drawer.CategoryKey;
+++ /dev/null
-/*
- * Copyright (C) 2014 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.dashboard;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.os.Bundle;
-
-import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-public class NoHomeDialogFragment extends InstrumentedDialogFragment {
- public static void show(Activity parent) {
- final NoHomeDialogFragment dialog = new NoHomeDialogFragment();
- dialog.show(parent.getFragmentManager(), null);
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- return new AlertDialog.Builder(getActivity())
- .setMessage(R.string.only_one_home_message)
- .setPositiveButton(android.R.string.ok, null)
- .create();
- }
-
- @Override
- public int getMetricsCategory() {
- return MetricsProto.MetricsEvent.DIALOG_NO_HOME;
- }
-}
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * 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
+ * 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.
+ * 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.dashboard;
+package com.android.settings.dashboard.suggestions;
import android.app.AutomaticZenRule;
import android.app.IWallpaperManager;
import android.os.ServiceManager;
import com.android.ims.ImsManager;
-import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
import com.android.settings.Settings.FingerprintEnrollSuggestionActivity;
import com.android.settings.Settings.FingerprintSuggestionActivity;
import com.android.settings.Settings.ScreenLockSuggestionActivity;
import com.android.settings.Settings.WifiCallingSuggestionActivity;
import com.android.settings.Settings.ZenModeAutomationSuggestionActivity;
import com.android.settings.Utils;
-import com.android.settings.WallpaperSuggestionActivity;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.wallpaper.WallpaperSuggestionActivity;
import com.android.settingslib.drawer.Tile;
import java.util.Collection;
* limitations under the License.
*/
-package com.android.settings;
+package com.android.settings.development;
import android.app.ListActivity;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.ListView;
+import com.android.settings.R;
import com.android.settings.applications.AppViewHolder;
import java.text.Collator;
import android.support.annotation.DrawableRes;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.XmlRes;
+
import com.android.settings.DateTimeSettings;
import com.android.settings.DevelopmentSettings;
import com.android.settings.DeviceInfoSettings;
import com.android.settings.DisplaySettings;
import com.android.settings.EncryptionAndCredential;
import com.android.settings.LegalSettings;
-import com.android.settings.PrivacySettings;
import com.android.settings.R;
import com.android.settings.ScreenPinningSettings;
import com.android.settings.SecuritySettings;
-import com.android.settings.WallpaperTypeSettings;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.accounts.UserAndAccountDashboardFragment;
import com.android.settings.applications.AdvancedAppSettings;
import com.android.settings.tts.TtsEnginePreferenceFragment;
import com.android.settings.tts.TtsSlidersFragment;
import com.android.settings.users.UserSettings;
+import com.android.settings.wallpaper.WallpaperTypeSettings;
import com.android.settings.wifi.ConfigureWifiSettings;
import com.android.settings.wifi.SavedAccessPointsWifiSettings;
import com.android.settings.wifi.WifiSettings;
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * 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.
* 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
+ * limitations under the License.
*/
-package com.android.settings;
+package com.android.settings.wallpaper;
import android.app.Activity;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Bundle;
+import android.support.annotation.VisibleForTesting;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.Utils;
public class WallpaperSuggestionActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Intent intent = new Intent()
+ final PackageManager pm = getPackageManager();
+ final Intent intent = new Intent()
.setClassName(getString(R.string.config_wallpaper_picker_package),
getString(R.string.config_wallpaper_picker_class))
.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
- startActivity(intent);
+ if (pm.resolveActivity(intent, 0) != null) {
+ startActivity(intent);
+ } else {
+ startFallbackSuggestion();
+ }
+
finish();
}
+
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ void startFallbackSuggestion() {
+ // fall back to default wallpaper picker
+ Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(), null, null, 0,
+ R.string.wallpaper_suggestion_title, null,
+ MetricsProto.MetricsEvent.DASHBOARD_SUMMARY);
+ }
+
}
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
* limitations under the License.
*/
-package com.android.settings;
+package com.android.settings.wallpaper;
import android.content.ComponentName;
import android.content.Context;
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
--- /dev/null
+/*
+ * 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.
+ */
+
+package com.android.settings.wallpaper;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+
+import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.SubSettings;
+import com.android.settings.TestConfig;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowActivity;
+import org.robolectric.util.ActivityController;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.when;
+import static org.robolectric.Shadows.shadowOf;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class WallpaperSuggestionActivityTest {
+
+ @Mock
+ private Context mContext;
+ @Mock
+ private PackageManager mPackageManager;
+ private ActivityController<WallpaperSuggestionActivity> mController;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ when(mContext.getPackageManager()).thenReturn(mPackageManager);
+ mController = Robolectric.buildActivity(WallpaperSuggestionActivity.class);
+ }
+
+ @Test
+ public void launch_primarySuggestionActivityDoesNotExist_shouldFallback() {
+ ShadowActivity activity = shadowOf(mController.setup().get());
+ final Intent intent = activity.getNextStartedActivity();
+
+ assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
+ }
+}