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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java

Issue 2363113003: Lint suppressions needed for Android SDK roll. (Closed)
Patch Set: Suppress alert box presubmit. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.externalauth; 5 package org.chromium.chrome.browser.externalauth;
6 6
7 import android.annotation.SuppressLint;
7 import android.content.Context; 8 import android.content.Context;
8 import android.content.pm.ApplicationInfo; 9 import android.content.pm.ApplicationInfo;
9 import android.content.pm.PackageManager; 10 import android.content.pm.PackageManager;
10 import android.content.pm.PackageManager.NameNotFoundException; 11 import android.content.pm.PackageManager.NameNotFoundException;
11 import android.os.Binder; 12 import android.os.Binder;
12 import android.os.StrictMode; 13 import android.os.StrictMode;
13 import android.os.SystemClock; 14 import android.os.SystemClock;
14 import android.text.TextUtils; 15 import android.text.TextUtils;
15 16
16 import com.google.android.gms.common.ConnectionResult; 17 import com.google.android.gms.common.ConnectionResult;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 PackageManager pm = context.getApplicationContext().getPackageManager(); 68 PackageManager pm = context.getApplicationContext().getPackageManager();
68 return pm.getPackagesForUid(callingUid); 69 return pm.getPackagesForUid(callingUid);
69 } 70 }
70 71
71 /** 72 /**
72 * Returns whether the caller application is a part of the system build. 73 * Returns whether the caller application is a part of the system build.
73 * @param pm Package manager to use for getting package related info. 74 * @param pm Package manager to use for getting package related info.
74 * @param packageName The package name to inquire about. 75 * @param packageName The package name to inquire about.
75 */ 76 */
76 @VisibleForTesting 77 @VisibleForTesting
78 // TODO(crbug.com/635567): Fix this properly.
79 @SuppressLint("WrongConstant")
77 public boolean isSystemBuild(PackageManager pm, String packageName) { 80 public boolean isSystemBuild(PackageManager pm, String packageName) {
78 try { 81 try {
79 ApplicationInfo info = pm.getApplicationInfo(packageName, Applicatio nInfo.FLAG_SYSTEM); 82 ApplicationInfo info = pm.getApplicationInfo(packageName, Applicatio nInfo.FLAG_SYSTEM);
80 if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) throw new Secur ityException(); 83 if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) throw new Secur ityException();
81 } catch (NameNotFoundException e) { 84 } catch (NameNotFoundException e) {
82 Log.e(TAG, "Package with name " + packageName + " not found"); 85 Log.e(TAG, "Package with name " + packageName + " not found");
83 return false; 86 return false;
84 } catch (SecurityException e) { 87 } catch (SecurityException e) {
85 Log.e(TAG, "Caller with package name " + packageName + " is not in t he system build"); 88 Log.e(TAG, "Caller with package name " + packageName + " is not in t he system build");
86 return false; 89 return false;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 /** 266 /**
264 * Invokes whatever external code is necessary to obtain a textual descripti on of an error 267 * Invokes whatever external code is necessary to obtain a textual descripti on of an error
265 * code produced by {@link #checkGooglePlayServicesAvailable(Context)}. 268 * code produced by {@link #checkGooglePlayServicesAvailable(Context)}.
266 * @param errorCode The code to check 269 * @param errorCode The code to check
267 * @return a textual description of the error code 270 * @return a textual description of the error code
268 */ 271 */
269 protected String describeError(final int errorCode) { 272 protected String describeError(final int errorCode) {
270 return GoogleApiAvailability.getInstance().getErrorString(errorCode); 273 return GoogleApiAvailability.getInstance().getErrorString(errorCode);
271 } 274 }
272 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698