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

Side by Side Diff: net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java

Issue 2830843004: Update to newer Android Lint and suppress new Lint errors (Closed)
Patch Set: rebase Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.net; 5 package org.chromium.net;
6 6
7 import static android.net.ConnectivityManager.TYPE_VPN; 7 import static android.net.ConnectivityManager.TYPE_VPN;
8 import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET; 8 import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
9 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN; 9 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN;
10 import static android.net.NetworkCapabilities.TRANSPORT_VPN; 10 import static android.net.NetworkCapabilities.TRANSPORT_VPN;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 // For testing. 345 // For testing.
346 WifiManagerDelegate() { 346 WifiManagerDelegate() {
347 // All the methods below should be overridden. 347 // All the methods below should be overridden.
348 mContext = null; 348 mContext = null;
349 } 349 }
350 350
351 // Lazily determine if app has ACCESS_WIFI_STATE permission. 351 // Lazily determine if app has ACCESS_WIFI_STATE permission.
352 @GuardedBy("mLock") 352 @GuardedBy("mLock")
353 @SuppressLint("WifiManagerPotentialLeak")
353 private boolean hasPermissionLocked() { 354 private boolean hasPermissionLocked() {
354 if (mHasWifiPermissionComputed) { 355 if (mHasWifiPermissionComputed) {
355 return mHasWifiPermission; 356 return mHasWifiPermission;
356 } 357 }
357 mHasWifiPermission = mContext.getPackageManager().checkPermission( 358 mHasWifiPermission = mContext.getPackageManager().checkPermission(
358 permission.ACCESS_WIFI_STATE, mContext. getPackageName()) 359 permission.ACCESS_WIFI_STATE, mContext. getPackageName())
359 == PackageManager.PERMISSION_GRANTED; 360 == PackageManager.PERMISSION_GRANTED;
361 // TODO(crbug.com/635567): Fix lint properly.
360 mWifiManager = mHasWifiPermission 362 mWifiManager = mHasWifiPermission
361 ? (WifiManager) mContext.getSystemService(Context.WIFI_SERVI CE) 363 ? (WifiManager) mContext.getSystemService(Context.WIFI_SERVI CE)
362 : null; 364 : null;
363 mHasWifiPermissionComputed = true; 365 mHasWifiPermissionComputed = true;
364 return mHasWifiPermission; 366 return mHasWifiPermission;
365 } 367 }
366 368
367 String getWifiSsid() { 369 String getWifiSsid() {
368 // Synchronized because this method can be called on multiple thread s (e.g. UI thread 370 // Synchronized because this method can be called on multiple thread s (e.g. UI thread
369 // from a private caller, and another thread calling a public API li ke 371 // from a private caller, and another thread calling a public API li ke
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 return network.getNetworkHandle(); 1049 return network.getNetworkHandle();
1048 } else { 1050 } else {
1049 // NOTE(pauljensen): This depends on Android framework implementatio n details. These 1051 // NOTE(pauljensen): This depends on Android framework implementatio n details. These
1050 // details cannot change because Lollipop is long since released. 1052 // details cannot change because Lollipop is long since released.
1051 // NetIDs are only 16-bit so use parseInt. This function returns a l ong because 1053 // NetIDs are only 16-bit so use parseInt. This function returns a l ong because
1052 // getNetworkHandle() returns a long. 1054 // getNetworkHandle() returns a long.
1053 return Integer.parseInt(network.toString()); 1055 return Integer.parseInt(network.toString());
1054 } 1056 }
1055 } 1057 }
1056 } 1058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698