Loading core/java/com/android/internal/app/IBatteryStats.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ interface IBatteryStats { void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph); void noteWifiBatchedScanStoppedFromSource(in WorkSource ws); void noteWifiRadioPowerState(int powerState, long timestampNs, int uid); void noteNetworkInterfaceForTransports(String iface, in int[] transportTypes); void noteNetworkInterfaceType(String iface, int type); void noteNetworkStatsEnabled(); void noteDeviceIdleMode(int mode, String activeReason, int activeUid); void setBatteryState(int status, int health, int plugType, int level, int temp, int volt, Loading core/java/com/android/internal/os/BatteryStatsHelper.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; import android.hardware.SensorManager; import android.net.ConnectivityManager; import android.os.BatteryStats; import android.os.BatteryStats.Uid; import android.os.Build; Loading @@ -36,7 +37,6 @@ import android.os.SELinux; import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.telephony.TelephonyManager; import android.text.format.DateUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -120,11 +120,12 @@ public class BatteryStatsHelper { private double mMaxDrainedPower; public static boolean checkWifiOnly(Context context) { final TelephonyManager tm = context.getSystemService(TelephonyManager.class); if (tm == null) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); if (cm == null) { return false; } return !tm.isDataCapable(); return !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); } @UnsupportedAppUsage Loading core/java/com/android/internal/os/BatteryStatsImpl.java +4 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.internal.os; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkCapabilities.TRANSPORT_WIFI; import static android.os.BatteryStatsManager.NUM_WIFI_STATES; import static android.os.BatteryStatsManager.NUM_WIFI_SUPPL_STATES; Loading @@ -38,6 +36,7 @@ import android.content.IntentFilter; import android.database.ContentObserver; import android.hardware.usb.UsbManager; import android.location.GnssSignalQuality; import android.net.ConnectivityManager; import android.net.INetworkStatsService; import android.net.NetworkStats; import android.net.Uri; Loading Loading @@ -112,7 +111,6 @@ import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastPrintWriter; import com.android.internal.util.FrameworkStatsLog; import com.android.internal.util.XmlUtils; import com.android.net.module.util.NetworkCapabilitiesUtils; import libcore.util.EmptyArray; Loading Loading @@ -6713,12 +6711,11 @@ public class BatteryStatsImpl extends BatteryStats { } /** @hide */ public void noteNetworkInterfaceForTransports(String iface, int[] transportTypes) { public void noteNetworkInterfaceType(String iface, int networkType) { if (TextUtils.isEmpty(iface)) return; final int displayTransport = NetworkCapabilitiesUtils.getDisplayTransport(transportTypes); synchronized (mModemNetworkLock) { if (displayTransport == TRANSPORT_CELLULAR) { if (ConnectivityManager.isNetworkTypeMobile(networkType)) { mModemIfaces = includeInStringArray(mModemIfaces, iface); if (DEBUG) Slog.d(TAG, "Note mobile iface " + iface + ": " + mModemIfaces); } else { Loading @@ -6728,7 +6725,7 @@ public class BatteryStatsImpl extends BatteryStats { } synchronized (mWifiNetworkLock) { if (displayTransport == TRANSPORT_WIFI) { if (ConnectivityManager.isNetworkTypeWifi(networkType)) { mWifiIfaces = includeInStringArray(mWifiIfaces, iface); if (DEBUG) Slog.d(TAG, "Note wifi iface " + iface + ": " + mWifiIfaces); } else { Loading services/core/java/com/android/server/ConnectivityService.java +5 −5 Original line number Diff line number Diff line Loading @@ -6108,7 +6108,7 @@ public class ConnectivityService extends IConnectivityManager.Stub nai.networkAgentPortalData = lp.getCaptivePortalData(); } private void updateLinkProperties(NetworkAgentInfo networkAgent, @NonNull LinkProperties newLp, private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, @NonNull LinkProperties oldLp) { int netId = networkAgent.network.getNetId(); Loading @@ -6117,7 +6117,8 @@ public class ConnectivityService extends IConnectivityManager.Stub // the LinkProperties for the network are accurate. networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities, networkAgent.networkInfo.getType()); // update filtering rules, need to happen after the interface update so netd knows about the // new interface (the interface name -> index map becomes initialized) Loading Loading @@ -6256,7 +6257,7 @@ public class ConnectivityService extends IConnectivityManager.Stub private void updateInterfaces(final @Nullable LinkProperties newLp, final @Nullable LinkProperties oldLp, final int netId, final @NonNull NetworkCapabilities caps) { final @Nullable NetworkCapabilities caps, final int legacyType) { final CompareResult<String> interfaceDiff = new CompareResult<>( oldLp != null ? oldLp.getAllInterfaceNames() : null, newLp != null ? newLp.getAllInterfaceNames() : null); Loading @@ -6267,7 +6268,7 @@ public class ConnectivityService extends IConnectivityManager.Stub if (DBG) log("Adding iface " + iface + " to network " + netId); mNetd.networkAddInterface(netId, iface); wakeupModifyInterface(iface, caps, true); bs.noteNetworkInterfaceForTransports(iface, caps.getTransportTypes()); bs.noteNetworkInterfaceType(iface, legacyType); } catch (Exception e) { loge("Exception adding interface: " + e); } Loading Loading @@ -6539,7 +6540,6 @@ public class ConnectivityService extends IConnectivityManager.Stub * maintained here that the NetworkAgent is not aware of (e.g., validated, captive portal, * and foreground status). */ @NonNull private NetworkCapabilities mixInCapabilities(NetworkAgentInfo nai, NetworkCapabilities nc) { // Once a NetworkAgent is connected, complain if some immutable capabilities are removed. // Don't complain for VPNs since they're not driven by requests and there is no risk of Loading services/core/java/com/android/server/am/BatteryStatsService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1674,11 +1674,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub } @Override public void noteNetworkInterfaceForTransports(final String iface, int[] transportTypes) { public void noteNetworkInterfaceType(final String iface, final int networkType) { enforceCallingPermission(); synchronized (mLock) { mHandler.post(() -> { mStats.noteNetworkInterfaceForTransports(iface, transportTypes); mStats.noteNetworkInterfaceType(iface, networkType); }); } } Loading Loading
core/java/com/android/internal/app/IBatteryStats.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ interface IBatteryStats { void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph); void noteWifiBatchedScanStoppedFromSource(in WorkSource ws); void noteWifiRadioPowerState(int powerState, long timestampNs, int uid); void noteNetworkInterfaceForTransports(String iface, in int[] transportTypes); void noteNetworkInterfaceType(String iface, int type); void noteNetworkStatsEnabled(); void noteDeviceIdleMode(int mode, String activeReason, int activeUid); void setBatteryState(int status, int health, int plugType, int level, int temp, int volt, Loading
core/java/com/android/internal/os/BatteryStatsHelper.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; import android.hardware.SensorManager; import android.net.ConnectivityManager; import android.os.BatteryStats; import android.os.BatteryStats.Uid; import android.os.Build; Loading @@ -36,7 +37,6 @@ import android.os.SELinux; import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.telephony.TelephonyManager; import android.text.format.DateUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -120,11 +120,12 @@ public class BatteryStatsHelper { private double mMaxDrainedPower; public static boolean checkWifiOnly(Context context) { final TelephonyManager tm = context.getSystemService(TelephonyManager.class); if (tm == null) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); if (cm == null) { return false; } return !tm.isDataCapable(); return !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); } @UnsupportedAppUsage Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +4 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,6 @@ package com.android.internal.os; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkCapabilities.TRANSPORT_WIFI; import static android.os.BatteryStatsManager.NUM_WIFI_STATES; import static android.os.BatteryStatsManager.NUM_WIFI_SUPPL_STATES; Loading @@ -38,6 +36,7 @@ import android.content.IntentFilter; import android.database.ContentObserver; import android.hardware.usb.UsbManager; import android.location.GnssSignalQuality; import android.net.ConnectivityManager; import android.net.INetworkStatsService; import android.net.NetworkStats; import android.net.Uri; Loading Loading @@ -112,7 +111,6 @@ import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastPrintWriter; import com.android.internal.util.FrameworkStatsLog; import com.android.internal.util.XmlUtils; import com.android.net.module.util.NetworkCapabilitiesUtils; import libcore.util.EmptyArray; Loading Loading @@ -6713,12 +6711,11 @@ public class BatteryStatsImpl extends BatteryStats { } /** @hide */ public void noteNetworkInterfaceForTransports(String iface, int[] transportTypes) { public void noteNetworkInterfaceType(String iface, int networkType) { if (TextUtils.isEmpty(iface)) return; final int displayTransport = NetworkCapabilitiesUtils.getDisplayTransport(transportTypes); synchronized (mModemNetworkLock) { if (displayTransport == TRANSPORT_CELLULAR) { if (ConnectivityManager.isNetworkTypeMobile(networkType)) { mModemIfaces = includeInStringArray(mModemIfaces, iface); if (DEBUG) Slog.d(TAG, "Note mobile iface " + iface + ": " + mModemIfaces); } else { Loading @@ -6728,7 +6725,7 @@ public class BatteryStatsImpl extends BatteryStats { } synchronized (mWifiNetworkLock) { if (displayTransport == TRANSPORT_WIFI) { if (ConnectivityManager.isNetworkTypeWifi(networkType)) { mWifiIfaces = includeInStringArray(mWifiIfaces, iface); if (DEBUG) Slog.d(TAG, "Note wifi iface " + iface + ": " + mWifiIfaces); } else { Loading
services/core/java/com/android/server/ConnectivityService.java +5 −5 Original line number Diff line number Diff line Loading @@ -6108,7 +6108,7 @@ public class ConnectivityService extends IConnectivityManager.Stub nai.networkAgentPortalData = lp.getCaptivePortalData(); } private void updateLinkProperties(NetworkAgentInfo networkAgent, @NonNull LinkProperties newLp, private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, @NonNull LinkProperties oldLp) { int netId = networkAgent.network.getNetId(); Loading @@ -6117,7 +6117,8 @@ public class ConnectivityService extends IConnectivityManager.Stub // the LinkProperties for the network are accurate. networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities, networkAgent.networkInfo.getType()); // update filtering rules, need to happen after the interface update so netd knows about the // new interface (the interface name -> index map becomes initialized) Loading Loading @@ -6256,7 +6257,7 @@ public class ConnectivityService extends IConnectivityManager.Stub private void updateInterfaces(final @Nullable LinkProperties newLp, final @Nullable LinkProperties oldLp, final int netId, final @NonNull NetworkCapabilities caps) { final @Nullable NetworkCapabilities caps, final int legacyType) { final CompareResult<String> interfaceDiff = new CompareResult<>( oldLp != null ? oldLp.getAllInterfaceNames() : null, newLp != null ? newLp.getAllInterfaceNames() : null); Loading @@ -6267,7 +6268,7 @@ public class ConnectivityService extends IConnectivityManager.Stub if (DBG) log("Adding iface " + iface + " to network " + netId); mNetd.networkAddInterface(netId, iface); wakeupModifyInterface(iface, caps, true); bs.noteNetworkInterfaceForTransports(iface, caps.getTransportTypes()); bs.noteNetworkInterfaceType(iface, legacyType); } catch (Exception e) { loge("Exception adding interface: " + e); } Loading Loading @@ -6539,7 +6540,6 @@ public class ConnectivityService extends IConnectivityManager.Stub * maintained here that the NetworkAgent is not aware of (e.g., validated, captive portal, * and foreground status). */ @NonNull private NetworkCapabilities mixInCapabilities(NetworkAgentInfo nai, NetworkCapabilities nc) { // Once a NetworkAgent is connected, complain if some immutable capabilities are removed. // Don't complain for VPNs since they're not driven by requests and there is no risk of Loading
services/core/java/com/android/server/am/BatteryStatsService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1674,11 +1674,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub } @Override public void noteNetworkInterfaceForTransports(final String iface, int[] transportTypes) { public void noteNetworkInterfaceType(final String iface, final int networkType) { enforceCallingPermission(); synchronized (mLock) { mHandler.post(() -> { mStats.noteNetworkInterfaceForTransports(iface, transportTypes); mStats.noteNetworkInterfaceType(iface, networkType); }); } } Loading