Merge "Rework the location navigation flow" into pi-car-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a91f8f3..e69f518 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -129,11 +129,6 @@
             </intent-filter>
 
             <intent-filter android:priority="100">
-                <action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-
-            <intent-filter android:priority="100">
                 <action android:name="android.settings.LOCATION_SCANNING_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
@@ -298,6 +293,17 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".location.LocationSettingsActivity"
+                  android:configChanges="orientation|keyboardHidden|screenSize"
+                  android:windowSoftInputMode="adjustResize"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="distractionOptimized" android:value="true"/>
+        </activity>
+
         <!-- This logic is copied from phone.-->
         <!-- Ensures there's lightweight fallback activity when no other MAIN/HOME activity is present.-->
         <activity android:name=".FallbackHome"
diff --git a/src/com/android/car/settings/common/FragmentResolver.java b/src/com/android/car/settings/common/FragmentResolver.java
index 0bd14c6..8518825 100644
--- a/src/com/android/car/settings/common/FragmentResolver.java
+++ b/src/com/android/car/settings/common/FragmentResolver.java
@@ -41,7 +41,6 @@
 import com.android.car.settings.inputmethod.KeyboardFragment;
 import com.android.car.settings.language.LanguagePickerFragment;
 import com.android.car.settings.location.LocationScanningFragment;
-import com.android.car.settings.location.LocationSettingsFragment;
 import com.android.car.settings.network.MobileNetworkFragment;
 import com.android.car.settings.quicksettings.QuickSettingFragment;
 import com.android.car.settings.sound.SoundSettingsFragment;
@@ -108,9 +107,6 @@
             case Settings.ACTION_BLUETOOTH_SETTINGS:
                 return new BluetoothSettingsFragment();
 
-            case Settings.ACTION_LOCATION_SOURCE_SETTINGS:
-                return new LocationSettingsFragment();
-
             case Settings.ACTION_LOCATION_SCANNING_SETTINGS:
                 return new LocationScanningFragment();
 
diff --git a/src/com/android/car/settings/location/LocationSettingsActivity.java b/src/com/android/car/settings/location/LocationSettingsActivity.java
new file mode 100644
index 0000000..732ab29
--- /dev/null
+++ b/src/com/android/car/settings/location/LocationSettingsActivity.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 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.car.settings.location;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+import com.android.car.settings.common.BaseCarSettingsActivity;
+
+/**
+ * Starts {@link LocationSettingsFragment} in a separate activity to help with back navigation flow.
+ */
+public class LocationSettingsActivity extends BaseCarSettingsActivity {
+
+    @Nullable
+    @Override
+    protected Fragment getInitialFragment() {
+        return new LocationSettingsFragment();
+    }
+}