Skip to content

Commit

Permalink
Update UI for unsupported Android OS and make Jelly Bean unsupported.
Browse files Browse the repository at this point in the history
This CL updates the UI to show a badge icon in the app menu icon
whenever the user is running Chrome on a currently unsupported Android
version.  This badge in the app menu is only displayed once, until the
user taps the app menu icon. If the user does in fact get a new version,
the badge state is reset, and will be shown again. The current behavior
for out of date users stays the same as before (once per cold start).

In addition, a new menu item is displayed at the top of the menu that
explains that Chrome is unable to update. Nothing happens when you tap
the menu item in the case of an unsupported OS version.

The new menu item and the new warning message in About Chrome will
always be displayed when the user is in this state, regardless of
whether the app menu has already been tapped (which removes the badge).

This CL also updates the UI in Settings - About Chrome to show a new
message and a warning icon when the user is running Chrome on an
unsupported version of the Android OS.

By default, Jelly Bean is considered unsupported after this CL, but this
can be overridden from the variations framework.

It is possible to use command line flags or chrome://flags for
testing the different states, though that does not impact the
About Chrome screen.

Binary-Size: This CL adds new assets and the minimal code required.
Bug: 847940
Change-Id: If128e1692b66c5804928183718000aaf1e2ffaa6
Reviewed-on: https://chromium-review.googlesource.com/c/1243167
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: Theresa <twellington@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#599369}(cherry picked from commit 5423fd8)
Reviewed-on: https://chromium-review.googlesource.com/c/1279959
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/branch-heads/3578@{#15}
Cr-Branched-From: 4226ddf-refs/heads/master@{#599034}
  • Loading branch information
tommynyquist committed Oct 15, 2018
1 parent a2c2b8f commit 601b3e3
Show file tree
Hide file tree
Showing 41 changed files with 612 additions and 180 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<!-- Layout for a preference with a title and a compound drawable below. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/PreferenceLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@android:id/title"
style="@style/PreferenceTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/os_version_title" />

<TextView
android:id="@android:id/summary"
style="@style/PreferenceSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/os_deprecation_warning"
style="@style/PreferenceSummary"
android:layout_marginTop="7dp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="@string/deprecation_warning"
android:drawablePadding="30dp"
android:drawableEnd="@drawable/exclamation_triangle"
android:layout_marginEnd="17dp"
android:visibility="gone" />
</LinearLayout>
6 changes: 4 additions & 2 deletions chrome/android/java/res/layout/toolbar_tablet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default"
android:visibility="gone" />

<FrameLayout
<org.chromium.chrome.browser.toolbar.MenuButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/menu_button_wrapper" >
Expand All @@ -78,6 +78,7 @@
style="@style/ToolbarMenuButtonTablet"
android:src="@drawable/ic_more_vert_black_24dp"
android:contentDescription="@string/accessibility_toolbar_btn_menu"
android:layout_gravity="center"
app:tint="@color/dark_mode_tint" />

<ImageView
Expand All @@ -86,8 +87,9 @@
android:src="@drawable/badge_update_dark"
tools:ignore="ContentDescription"
android:importantForAccessibility="no"
android:layout_gravity="center"
android:visibility="invisible" />

</FrameLayout>
</org.chromium.chrome.browser.toolbar.MenuButton>
</LinearLayout>
</org.chromium.chrome.browser.toolbar.ToolbarTablet>
3 changes: 0 additions & 3 deletions chrome/android/java/res/values-v17/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@
<item name="android:paddingEnd">8dp</item>
</style>
<style name="PreferenceLayout" parent="PreferenceLayoutBase" />
<style name="DeprecationWarningPreferenceTheme" parent="PreferencesTheme">
<item name="android:textAppearance">@style/BlackBodyDefault</item>
</style>
<style name="PreferenceSpinnerItem">
<item name="android:textAppearance">@style/TextAppearance.PreferenceMediumText</item>
</style>
Expand Down
2 changes: 1 addition & 1 deletion chrome/android/java/res/xml/about_chrome_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Preference
android:key="application_version"
android:title="@string/application_version_title" />
<Preference
<org.chromium.chrome.browser.preferences.AboutChromePreferenceOSVersion
android:key="os_version"
android:title="@string/os_version_title" />
<Preference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,8 @@ public AppMenuPropertiesDelegate getAppMenuPropertiesDelegate() {

/**
* Callback after UpdateMenuItemHelper#checkForUpdateOnBackgroundThread is complete.
* @param updateAvailable Whether an update is available.
*/
public void onCheckForUpdate(boolean updateAvailable) {
public void onCheckForUpdate() {
if (UpdateMenuItemHelper.getInstance().shouldShowToolbarBadge(this)) {
mToolbarManager.showAppMenuUpdateBadge();
mCompositorViewHolder.requestRender();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public static boolean getFieldTrialParamByFeatureAsBoolean(
public static final String INFLATE_TOOLBAR_ON_BACKGROUND_THREAD = "BackgroundToolbarInflation";
public static final String INTEREST_FEED_CONTENT_SUGGESTIONS = "InterestFeedContentSuggestions";
public static final String LANGUAGES_PREFERENCE = "LanguagesPreference";
public static final String JELLY_BEAN_SUPPORTED = "JellyBeanSupported";
public static final String LONG_PRESS_BACK_FOR_HISTORY = "LongPressBackForHistory";
public static final String SEARCH_ENGINE_PROMO_EXISTING_DEVICE =
"SearchEnginePromo.ExistingDevice";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,26 @@ public abstract class ChromeSwitches {
public static final String DISABLE_LOFI_SNACKBAR = "disable-lo-fi-snackbar";

/**
* Forces the update menu item to show.
* Forces the update state to be set to the given state if the value is {@link
* org.chromium.chrome.browser.omaha.UpdateMenuItemHelper#NONE_SWITCH_VALUE}, {@link
* org.chromium.chrome.browser.omaha.UpdateMenuItemHelper#UPDATE_AVAILABLE_SWITCH_VALUE},
* {@link
* org.chromium.chrome.browser.omaha.UpdateMenuItemHelper#UNSUPPORTED_OS_VERSION_SWITCH_VALUE}.
*/
public static final String FORCE_SHOW_UPDATE_MENU_ITEM = "force-show-update-menu-item";
public static final String FORCE_UPDATE_MENU_UPDATE_TYPE = "force-update-menu-type";

/**
* Forces the update menu badge to show.
* Forces the update menu badge to show. This requires the update type to be valid as well.
*
* @see #FORCE_UPDATE_MENU_UPDATE_TYPE
*/
public static final String FORCE_SHOW_UPDATE_MENU_BADGE = "force-show-update-menu-badge";

/**
* Sets the market URL for Chrome for use in testing.
* Sets the market URL for Chrome for use in testing. This requires setting {@link
* #FORCE_UPDATE_MENU_UPDATE_TYPE} to {@link
* org.chromium.chrome.browser.omaha.UpdateMenuItemHelper#UPDATE_AVAILABLE_SWITCH_VALUE}.
* @see #FORCE_UPDATE_MENU_UPDATE_TYPE
*/
public static final String MARKET_URL_FOR_TESTING = "market-url-for-testing";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ protected boolean handleBackPressed() {
}

@Override
public void onCheckForUpdate(boolean updateAvailable) {}
public void onCheckForUpdate() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
holder = (CustomMenuItemViewHolder) convertView.getTag();
}
setupStandardMenuItemViewHolder(holder, convertView, item);
String summary = UpdateMenuItemHelper.getInstance().getMenuItemSummaryText(
mInflater.getContext());
if (TextUtils.isEmpty(summary)) {
holder.summary.setVisibility(View.GONE);
} else {
holder.summary.setText(summary);
}
UpdateMenuItemHelper.getInstance().decorateMenuItemViews(
mInflater.getContext(), holder.text, holder.image, holder.summary);
break;
}
case MenuItemType.THREE_BUTTON:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,7 @@ public CustomTabAppMenuPropertiesDelegate getAppMenuPropertiesDelegate() {
}

@Override
public void onCheckForUpdate(boolean updateAvailable) {
}
public void onCheckForUpdate() {}

/**
* @return The {@link CustomTabIntentDataProvider} for this {@link CustomTabActivity}. For test
Expand Down
Loading

0 comments on commit 601b3e3

Please sign in to comment.