Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4034)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java

Issue 2785373004: Remove BuildInfo#isGreaterThanN() (Closed)
Patch Set: Updates for network security config Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index 2c1b4e467e1ddffbf99c723fcc206d2687504c28..0df3c0636e1fd8aeb3af181d9c747e9d444c4372 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -13,6 +13,7 @@ import android.app.ActivityManager.RecentTaskInfo;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.pm.ShortcutManager;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
@@ -34,7 +35,6 @@ import android.widget.FrameLayout;
import org.chromium.base.ActivityState;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus;
-import org.chromium.base.BuildInfo;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
@@ -128,7 +128,6 @@ import org.chromium.ui.widget.Toast;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
-import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -1909,18 +1908,13 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
* was performed.
* @param isIncognito Whether the shortcut or action created a new incognito tab.
*/
- @TargetApi(25)
+ @TargetApi(Build.VERSION_CODES.N_MR1)
private void reportNewTabShortcutUsed(boolean isIncognito) {
- if (!BuildInfo.isGreaterThanN()) return;
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return;
- try {
- Class<?> clazz = Class.forName("android.content.pm.ShortcutManager");
- Method method = clazz.getDeclaredMethod("reportShortcutUsed", String.class);
- method.invoke(getSystemService(clazz),
- isIncognito ? "new-incognito-tab-shortcut" : "new-tab-shortcut");
- } catch (Exception e) {
- e.printStackTrace();
- }
+ ShortcutManager shortcutManager = (ShortcutManager) getSystemService(ShortcutManager.class);
+ shortcutManager.reportShortcutUsed(
+ isIncognito ? "new-incognito-tab-shortcut" : "new-tab-shortcut");
}
@Override
« no previous file with comments | « chrome/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698