OSDN Git Service

Merge "Only sync adapters with access can see an account - settings" into nyc-mr1-dev
authorTreeHugger Robot <treehugger-gerrit@google.com>
Tue, 23 Aug 2016 23:26:47 +0000 (23:26 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 23 Aug 2016 23:26:48 +0000 (23:26 +0000)
res/layout-land/fingerprint_enroll_enrolling.xml
res/layout/support_offline_escalation_options.xml
res/values/strings.xml
src/com/android/settings/dashboard/DashboardSummary.java
src/com/android/settings/users/UserSettings.java

index 8154d0c..ba0f803 100644 (file)
@@ -20,6 +20,7 @@
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:layout="@layout/suw_glif_blank_template"
     style="?attr/fingerprint_layout_theme">
 
     <LinearLayout
 
         <!-- Both texts are kept as separate text views so it doesn't jump around in portrait.
              See layouts/fingerprint_enroll_enrolling_base.xml. -->
-        <RelativeLayout
+        <LinearLayout
             android:layout_width="0dp"
             android:layout_weight="1"
-            android:layout_height="wrap_content">
+            android:layout_height="match_parent"
+            android:layout_marginStart="?attr/suwMarginSides"
+            android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
+            android:orientation="vertical">
 
-            <TextView
-                style="@style/TextAppearance.FingerprintMessage"
-                android:id="@+id/start_message"
-                android:layout_width="match_parent"
+            <ImageView
+                android:id="@+id/suw_layout_icon"
+                style="@style/SuwGlifIcon"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:text="@string/security_settings_fingerprint_enroll_start_message"/>
+                android:layout_marginStart="0dp"
+                android:layout_marginEnd="0dp"
+                android:src="@drawable/ic_lock" />
 
             <TextView
-                style="@style/TextAppearance.FingerprintMessage"
-                android:id="@+id/repeat_message"
+                android:id="@+id/suw_layout_title"
+                style="@style/SuwGlifHeaderTitle"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_alignParentTop="true"
-                android:text="@string/security_settings_fingerprint_enroll_repeat_message"
-                android:visibility="invisible"/>
+                android:layout_marginStart="0dp"
+                android:layout_marginEnd="0dp" />
+
+            <FrameLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <TextView
+                    style="@style/TextAppearance.FingerprintMessage"
+                    android:id="@+id/start_message"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/security_settings_fingerprint_enroll_start_message"/>
+
+                <TextView
+                    style="@style/TextAppearance.FingerprintMessage"
+                    android:id="@+id/repeat_message"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/security_settings_fingerprint_enroll_repeat_message"
+                    android:visibility="invisible"/>
+
+            </FrameLayout>
 
             <Button
                 android:id="@+id/skip_button"
                 style="@style/SetupWizardButton.Negative"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentBottom="true"
-                android:layout_marginBottom="8dp"
+                android:layout_marginTop="8dp"
                 android:text="@string/skip_label"
                 android:visibility="gone" />
 
-        </RelativeLayout>
+        </LinearLayout>
 
         <FrameLayout
             android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_marginBottom="16dp"
                 android:layout_gravity="center_horizontal|bottom"
+                android:accessibilityLiveRegion="polite"
                 android:visibility="invisible"/>
 
         </FrameLayout>
index 08c52aa..18d8f98 100644 (file)
@@ -59,7 +59,8 @@
         style="@style/SupportPrimaryButton"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_margin="8dp"/>
+        android:layout_margin="8dp"
+        android:layoutDirection="ltr"/>
     <Button
         android:id="@android:id/text2"
         style="@style/SupportSecondaryButton"
index 9b8614a..cc3ee44 100644 (file)
     <!-- Text shown in fingerprint enroll when we didn't observe progress for a few seconds. [CHAR LIMIT=100] -->
     <string name="security_settings_fingerprint_enroll_lift_touch_again">Lift finger, then touch sensor again</string>
 
-    <!-- Message shown in fingerprint enrollment during setup wizard once enrollment is complete. [CHAR LIMIT=NONE] -->
-    <string name="setup_fingerprint_enroll_finish_message">Whenever you see this icon, you can use your fingerprint.</string>
-    <!-- Secondary message shown in fingerprint enrollment during setup wizard once enrollment is complete, telling the user how to change the settings after they are done with setup. [CHAR LIMIT=NONE] -->
-    <string name="setup_fingerprint_enroll_finish_secondary_message">To change your settings, go to Settings &gt; Security &gt; Fingerprint.</string>
-
     <!-- Text shown when "Add fingerprint" button is disabled -->
     <string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
 
index 1c7e22d..12f036a 100644 (file)
@@ -42,6 +42,7 @@ import com.android.settingslib.drawer.DashboardCategory;
 import com.android.settingslib.drawer.SettingsDrawerActivity;
 import com.android.settingslib.drawer.Tile;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class DashboardSummary extends InstrumentedFragment
@@ -63,6 +64,8 @@ public class DashboardSummary extends InstrumentedFragment
     private static final String SUGGESTIONS = "suggestions";
 
     private static final String EXTRA_SCROLL_POSITION = "scroll_position";
+    private static final String EXTRA_SUGGESTION_SHOWN_LOGGED = "suggestions_shown_logged";
+    private static final String EXTRA_SUGGESTION_HIDDEN_LOGGED = "suggestions_hidden_logged";
 
     private FocusRecyclerView mDashboard;
     private DashboardAdapter mAdapter;
@@ -71,6 +74,8 @@ public class DashboardSummary extends InstrumentedFragment
     private SuggestionParser mSuggestionParser;
     private LinearLayoutManager mLayoutManager;
     private SuggestionsChecks mSuggestionsChecks;
+    private ArrayList<String> mSuggestionsShownLogged;
+    private ArrayList<String> mSuggestionsHiddenLogged;
 
     @Override
     protected int getMetricsCategory() {
@@ -90,6 +95,15 @@ public class DashboardSummary extends InstrumentedFragment
         mSuggestionParser = new SuggestionParser(context,
                 context.getSharedPreferences(SUGGESTIONS, 0), R.xml.suggestion_ordering);
         mSuggestionsChecks = new SuggestionsChecks(getContext());
+        if (savedInstanceState == null) {
+            mSuggestionsShownLogged = new ArrayList<>();
+            mSuggestionsHiddenLogged = new ArrayList<>();
+        } else {
+            mSuggestionsShownLogged =
+                    savedInstanceState.getStringArrayList(EXTRA_SUGGESTION_SHOWN_LOGGED);
+            mSuggestionsHiddenLogged =
+                    savedInstanceState.getStringArrayList(EXTRA_SUGGESTION_HIDDEN_LOGGED);
+        }
         if (DEBUG_TIMING) Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime)
                 + " ms");
     }
@@ -112,12 +126,6 @@ public class DashboardSummary extends InstrumentedFragment
                 MetricsLogger.visible(getContext(), c.getMetricsConstant());
             }
         }
-        if (mAdapter.getSuggestions() != null) {
-            for (Tile suggestion : mAdapter.getSuggestions()) {
-                MetricsLogger.action(getContext(), MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION,
-                        DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
-            }
-        }
         if (DEBUG_TIMING) Log.d(TAG, "onStart took " + (System.currentTimeMillis() - startTime)
                 + " ms");
     }
@@ -136,9 +144,15 @@ public class DashboardSummary extends InstrumentedFragment
         if (mAdapter.getSuggestions() == null) {
             return;
         }
-        for (Tile suggestion : mAdapter.getSuggestions()) {
-            MetricsLogger.action(getContext(), MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION,
-                    DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
+        if (!getActivity().isChangingConfigurations()) {
+            for (Tile suggestion : mAdapter.getSuggestions()) {
+                String id = DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion);
+                if (!mSuggestionsHiddenLogged.contains(id)) {
+                    mSuggestionsHiddenLogged.add(id);
+                    MetricsLogger.action(getContext(),
+                            MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION, id);
+                }
+            }
         }
     }
 
@@ -169,6 +183,8 @@ public class DashboardSummary extends InstrumentedFragment
         if (mAdapter != null) {
             mAdapter.onSaveInstanceState(outState);
         }
+        outState.putStringArrayList(EXTRA_SUGGESTION_HIDDEN_LOGGED, mSuggestionsHiddenLogged);
+        outState.putStringArrayList(EXTRA_SUGGESTION_SHOWN_LOGGED, mSuggestionsShownLogged);
     }
 
     @Override
@@ -222,9 +238,17 @@ public class DashboardSummary extends InstrumentedFragment
         protected List<Tile> doInBackground(Void... params) {
             List<Tile> suggestions = mSuggestionParser.getSuggestions();
             for (int i = 0; i < suggestions.size(); i++) {
-                if (mSuggestionsChecks.isSuggestionComplete(suggestions.get(i))) {
-                    mAdapter.disableSuggestion(suggestions.get(i));
+                Tile suggestion = suggestions.get(i);
+                if (mSuggestionsChecks.isSuggestionComplete(suggestion)) {
+                    mAdapter.disableSuggestion(suggestion);
                     suggestions.remove(i--);
+                } else {
+                    String id = DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion);
+                    if (!mSuggestionsShownLogged.contains(id)) {
+                        mSuggestionsShownLogged.add(id);
+                        MetricsLogger.action(getContext(),
+                                MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, id);
+                    }
                 }
             }
             return suggestions;
index d943e52..4e0d8fa 100644 (file)
@@ -224,6 +224,7 @@ public class UserSettings extends SettingsPreferenceFragment
             mMePreference.setSummary(R.string.user_admin);
         }
         mAddUser = (DimmableIconPreference) findPreference(KEY_ADD_USER);
+        mAddUser.useAdminDisabledSummary(false);
         // Determine if add user/profile button should be visible
         if (mUserCaps.mCanAddUser && Utils.isDeviceProvisioned(getActivity())) {
             mAddUser.setOnPreferenceClickListener(this);