Commit 02ae8f5f authored by Bernhard Bauer's avatar Bernhard Bauer Committed by Commit Bot

Catch Resources.NotFoundException when inflating Remote Views for Custom Tab bottom toolbar.

Bug: 827326
Change-Id: Ifdbb8ded6b7d3f7571e40d24178a840c304eabe5
Reviewed-on: https://chromium-review.googlesource.com/992034Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547682}
parent 718e2ab2
......@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.customtabs;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
......@@ -80,29 +81,25 @@ class CustomTabBottomBarDelegate implements FullscreenListener {
mClickableIDs = mDataProvider.getClickableViewIDs();
mClickPendingIntent = mDataProvider.getRemoteViewsPendingIntent();
showRemoteViews(remoteViews);
} else {
List<CustomButtonParams> items = mDataProvider.getCustomButtonsOnBottombar();
if (items.isEmpty()) return;
LinearLayout layout = new LinearLayout(mActivity);
layout.setId(R.id.custom_tab_bottom_bar_wrapper);
layout.setBackgroundColor(mDataProvider.getBottomBarColor());
for (CustomButtonParams params : items) {
if (params.showOnToolbar()) continue;
final PendingIntent pendingIntent = params.getPendingIntent();
OnClickListener clickListener = null;
if (pendingIntent != null) {
clickListener = new OnClickListener() {
@Override
public void onClick(View v) {
sendPendingIntentWithUrl(pendingIntent, null, mActivity);
}
};
}
layout.addView(
params.buildBottomBarButton(mActivity, getBottomBarView(), clickListener));
return;
}
List<CustomButtonParams> items = mDataProvider.getCustomButtonsOnBottombar();
if (items.isEmpty()) return;
LinearLayout layout = new LinearLayout(mActivity);
layout.setId(R.id.custom_tab_bottom_bar_wrapper);
layout.setBackgroundColor(mDataProvider.getBottomBarColor());
for (CustomButtonParams params : items) {
if (params.showOnToolbar()) continue;
final PendingIntent pendingIntent = params.getPendingIntent();
OnClickListener clickListener = null;
if (pendingIntent != null) {
clickListener = v -> sendPendingIntentWithUrl(pendingIntent, null, mActivity);
}
getBottomBarView().addView(layout);
layout.addView(
params.buildBottomBarButton(mActivity, getBottomBarView(), clickListener));
}
getBottomBarView().addView(layout);
}
/**
......@@ -230,6 +227,9 @@ class CustomTabBottomBarDelegate implements FullscreenListener {
} catch (RemoteViews.ActionException e) {
Log.e(TAG, "Failed to inflate the RemoteViews", e);
return false;
} catch (Resources.NotFoundException e) {
Log.e(TAG, "Failed to inflate the RemoteViews", e);
return false;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment