Commit 936f6b2c authored by Sam Maier's avatar Sam Maier Committed by Commit Bot

Fixing easy to fix verification errors

Bug: 998231, 999186
Change-Id: If26cb58677341158e76bc2998bc24104db5fbbdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803732
Commit-Queue: Sam Maier <smaier@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697742}
parent 0bfec541
......@@ -50,11 +50,17 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.chromium.base.annotations.VerifiesOnLollipop;
import java.io.UnsupportedEncodingException;
/**
* Utility class to use new APIs that were added after KitKat (API level 19).
*
* Do not inline because we use many new APIs, and if they are inlined, they could cause dex
* validation errors on low Android versions.
*/
@VerifiesOnLollipop
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class ApiCompatibilityUtils {
private ApiCompatibilityUtils() {
......
......@@ -121,10 +121,11 @@ def _AdbOatDumpForPackage(device, package_name, out_file):
"""Runs oatdump on the device."""
# Get the path to the odex file.
odex_file = PathToDexForPlatformVersion(device, package_name)
device.RunShellCommand(['oatdump',
'--oat-file=' + odex_file,
'--output=' + out_file],
timeout=120, shell=True, check_return=True)
device.RunShellCommand(
['oatdump', '--oat-file=' + odex_file, '--output=' + out_file],
timeout=420,
shell=True,
check_return=True)
class JavaClass(object):
......@@ -211,7 +212,7 @@ def RealMain(mapping, device_arg, package, status, hide_summary, workdir):
device.adb) as file_on_device:
_AdbOatDumpForPackage(device, package, file_on_device.name)
file_on_host = os.path.join(workdir, 'out.dump')
device.PullFile(file_on_device.name, file_on_host)
device.PullFile(file_on_device.name, file_on_host, timeout=220)
proguard_mappings = (_ParseMappingFile(mapping) if mapping else None)
with open(file_on_host, 'r') as f:
java_classes = ListClassesAndVerificationStatus(f, proguard_mappings)
......
......@@ -11,6 +11,7 @@ import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.KeyboardShortcutInfo;
import org.chromium.base.annotations.VerifiesOnN;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModel;
......@@ -103,13 +104,16 @@ public class KeyboardShortcuts {
* appropriate group in this method so the user can see it when this method
* is called.
*
* Preventing inlining since this uses APIs only available on Android N, and this causes dex
* validation failures on earlier versions if inlined.
*
* @param context We need an activity so we can call the strings from our
* resource.
* @return a list of shortcuts organized into groups.
*/
@TargetApi(Build.VERSION_CODES.N)
@VerifiesOnN
public static List<KeyboardShortcutGroup> createShortcutGroup(Context context) {
final int ctrlShift = KeyEvent.META_CTRL_ON | KeyEvent.META_SHIFT_ON;
List<KeyboardShortcutGroup> shortcutGroups = new ArrayList<>();
......
......@@ -32,6 +32,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.SysUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.compat.ApiHelperForN;
import org.chromium.base.compat.ApiHelperForO;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.InsetObserverView;
......@@ -203,7 +204,7 @@ public class CompositorViewHolder extends FrameLayout
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return null;
View activeView = getContentView();
if (activeView == null || !ViewCompat.isAttachedToWindow(activeView)) return null;
return activeView.onResolvePointerIcon(event, pointerIndex);
return ApiHelperForN.onResolvePointerIcon(activeView, event, pointerIndex);
}
/**
......
......@@ -10,13 +10,13 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import org.chromium.base.Callback;
import org.chromium.base.Supplier;
import org.chromium.base.metrics.CachedMetrics;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* Reports available direct actions and executes them.
......
......@@ -4,7 +4,7 @@
package org.chromium.chrome.browser.media;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.PictureInPictureParams;
import android.content.pm.ActivityInfo;
......@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.Callback;
import org.chromium.base.Log;
import org.chromium.base.annotations.VerifiesOnO;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.ChromeActivity;
......@@ -41,8 +42,11 @@ import java.util.List;
/**
* A controller for entering Android O Picture in Picture mode with fullscreen videos.
*
* Do not inline to prevent class verification errors on pre-O runtimes.
*/
@SuppressLint({"NewApi"})
@VerifiesOnO
@TargetApi(Build.VERSION_CODES.O)
public class PictureInPictureController {
private static final String TAG = "VideoPersist";
......
......@@ -13,6 +13,7 @@ import org.chromium.base.ApplicationStatus;
import org.chromium.base.ApplicationStatus.ActivityStateListener;
import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.VerifiesOnN;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.ui.base.WindowAndroid;
......@@ -205,9 +206,12 @@ public class TabWindowManager implements ActivityStateListener {
}
private static class DefaultTabModelSelectorFactory implements TabModelSelectorFactory {
// Do not inline since this uses some APIs only available on Android N versions, which cause
// verification errors.
@VerifiesOnN
@Override
public TabModelSelector buildSelector(Activity activity,
TabCreatorManager tabCreatorManager, int selectorIndex) {
public TabModelSelector buildSelector(
Activity activity, TabCreatorManager tabCreatorManager, int selectorIndex) {
// Merge tabs if this TabModelSelector is for a ChromeTabbedActivity created in
// fullscreen mode and there are no TabModelSelector's currently alive. This indicates
// that it is a cold start or process restart in fullscreen mode.
......
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