OSDN Git Service

Fix non-unique keys for location settings
authorMaggie <yiranwang@google.com>
Fri, 2 Mar 2018 18:39:08 +0000 (10:39 -0800)
committerMaggie <yiranwang@google.com>
Fri, 2 Mar 2018 18:39:08 +0000 (10:39 -0800)
Bug: 74104689
Test: Robo
Change-Id: I54ead73b69a6c62897d6b99e14fa5b6627163052

res/xml/location_settings.xml
src/com/android/settings/location/RecentLocationRequestPreferenceController.java
tests/robotests/src/com/android/settings/location/RecentLocationRequestPreferenceControllerTest.java

index 3f96c58..d616bb6 100644 (file)
@@ -25,7 +25,7 @@
             android:title="@string/location_category_recent_location_requests"/>
 
         <Preference
-            android:key="recent_location_requests_see_all"
+            android:key="recent_location_requests_see_all_button"
             android:title="@string/location_recent_location_requests_see_all"
             android:icon="@drawable/ic_chevron_right_24dp"
             android:selectable="true"
index b017ec1..b2a648f 100644 (file)
@@ -34,7 +34,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
     /** Key for preference category "Recent location requests" */
     private static final String KEY_RECENT_LOCATION_REQUESTS = "recent_location_requests";
     @VisibleForTesting
-    static final String KEY_SEE_ALL = "recent_location_requests_see_all";
+    static final String KEY_SEE_ALL_BUTTON = "recent_location_requests_see_all_button";
     private final LocationSettings mFragment;
     private final RecentLocationApps mRecentLocationApps;
     private PreferenceCategory mCategoryRecentLocationRequests;
@@ -93,7 +93,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
         super.displayPreference(screen);
         mCategoryRecentLocationRequests =
                 (PreferenceCategory) screen.findPreference(KEY_RECENT_LOCATION_REQUESTS);
-        mSeeAllButton = screen.findPreference(KEY_SEE_ALL);
+        mSeeAllButton = screen.findPreference(KEY_SEE_ALL_BUTTON);
 
     }
 
index 1bacd5b..3c90989 100644 (file)
@@ -86,7 +86,7 @@ public class RecentLocationRequestPreferenceControllerTest {
         mController = spy(new RecentLocationRequestPreferenceController(
                 mContext, mFragment, mLifecycle, mRecentLocationApps));
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mCategory);
-        when(mScreen.findPreference(mController.KEY_SEE_ALL)).thenReturn(mSeeAllButton);
+        when(mScreen.findPreference(mController.KEY_SEE_ALL_BUTTON)).thenReturn(mSeeAllButton);
         final String key = mController.getPreferenceKey();
         when(mCategory.getKey()).thenReturn(key);
         when(mCategory.getContext()).thenReturn(mContext);