diff options
| -rw-r--r-- | cmds/statsd/src/atoms.proto | 25 | ||||
| -rw-r--r-- | cmds/statsd/src/external/StatsPullerManager.cpp | 3 | ||||
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 32 | ||||
| -rw-r--r-- | services/core/java/com/android/server/stats/StatsCompanionService.java | 10 | ||||
| -rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 38 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/ApnSetting.java | 22 |
6 files changed, 80 insertions, 50 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 0b810277ab66..eed7f62eac34 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -322,7 +322,7 @@ message Atom { } // Pulled events will start at field 10000. - // Next: 10059 + // Next: 10062 oneof pulled { WifiBytesTransfer wifi_bytes_transfer = 10000; WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001; @@ -385,6 +385,7 @@ message Atom { FaceSettings face_settings = 10058; CoolingDevice cooling_device = 10059; AppOps app_ops = 10060; + ProcessSystemIonHeapSize process_system_ion_heap_size = 10061; } // DO NOT USE field numbers above 100,000 in AOSP. @@ -6369,6 +6370,28 @@ message SystemIonHeapSize { optional int64 size_in_bytes = 1; } +/* + * Logs the per-process size of the system ion heap. + * + * Pulled from StatsCompanionService. + */ +message ProcessSystemIonHeapSize { + // The uid if available. -1 means not available. + optional int32 uid = 1 [(is_uid) = true]; + + // The process name (from /proc/PID/cmdline). + optional string process_name = 2; + + // Sum of sizes of all allocations. + optional int32 total_size_in_kilobytes = 3; + + // Number of allocations. + optional int32 allocation_count = 4; + + // Size of the largest allocation. + optional int32 max_size_in_kilobytes = 5; +} + /** * Push network stack events. * diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp index 914d60d3daca..475f18a9b0b8 100644 --- a/cmds/statsd/src/external/StatsPullerManager.cpp +++ b/cmds/statsd/src/external/StatsPullerManager.cpp @@ -156,6 +156,9 @@ std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { // system_ion_heap_size {android::util::SYSTEM_ION_HEAP_SIZE, {.puller = new StatsCompanionServicePuller(android::util::SYSTEM_ION_HEAP_SIZE)}}, + // process_system_ion_heap_size + {android::util::PROCESS_SYSTEM_ION_HEAP_SIZE, + {.puller = new StatsCompanionServicePuller(android::util::PROCESS_SYSTEM_ION_HEAP_SIZE)}}, // temperature {android::util::TEMPERATURE, {.puller = new StatsCompanionServicePuller(android::util::TEMPERATURE)}}, diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 1b41694e7d48..53298d8d8aed 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -30,7 +30,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; -import android.os.storage.IStorageManager; import android.provider.Settings; import android.telephony.euicc.EuiccManager; import android.text.TextUtils; @@ -39,8 +38,6 @@ import android.util.Log; import android.view.Display; import android.view.WindowManager; -import com.android.internal.content.PackageHelper; - import libcore.io.Streams; import java.io.ByteArrayInputStream; @@ -858,18 +855,31 @@ public class RecoverySystem { public static void rebootPromptAndWipeUserData(Context context, String reason) throws IOException { boolean checkpointing = false; + boolean needReboot = false; + IVold vold = null; + try { + vold = IVold.Stub.asInterface(ServiceManager.checkService("vold")); + if (vold != null) { + checkpointing = vold.needsCheckpoint(); + } else { + Log.w(TAG, "Failed to get vold"); + } + } catch (Exception e) { + Log.w(TAG, "Failed to check for checkpointing"); + } // If we are running in checkpointing mode, we should not prompt a wipe. // Checkpointing may save us. If it doesn't, we will wind up here again. - try { - IStorageManager storageManager = PackageHelper.getStorageManager(); - if (storageManager.needsCheckpoint()) { - Log.i(TAG, "Rescue Party requested wipe. Aborting update instead."); - storageManager.abortChanges("rescueparty", false); - return; + if (checkpointing) { + try { + vold.abortChanges("rescueparty", false); + Log.i(TAG, "Rescue Party requested wipe. Aborting update"); + } catch (Exception e) { + Log.i(TAG, "Rescue Party requested wipe. Rebooting instead."); + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + pm.reboot("rescueparty"); } - } catch (RemoteException e) { - Log.i(TAG, "Failed to handle with checkpointing. Continuing with wipe."); + return; } String reasonArg = null; diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java index 6b74c382afbe..2f95944f54f1 100644 --- a/services/core/java/com/android/server/stats/StatsCompanionService.java +++ b/services/core/java/com/android/server/stats/StatsCompanionService.java @@ -1271,6 +1271,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { pulledData.add(e); } + private void pullProcessSystemIonHeapSize( + int tagId, long elapsedNanos, long wallClockNanos, + List<StatsLogEventWrapper> pulledData) { + // TODO(b/130526489): Read from debugfs. + } + private void pullBinderCallsStats( int tagId, long elapsedNanos, long wallClockNanos, List<StatsLogEventWrapper> pulledData) { @@ -2333,6 +2339,10 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { pullSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret); break; } + case StatsLog.PROCESS_SYSTEM_ION_HEAP_SIZE: { + pullProcessSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret); + break; + } case StatsLog.BINDER_CALLS: { pullBinderCallsStats(tagId, elapsedNanos, wallClockNanos, ret); break; diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 518da74eb9e2..5d39a2cc194a 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -16,8 +16,6 @@ package android.telephony; -import static android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN; - import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -1607,12 +1605,6 @@ public class ServiceState implements Parcelable { } } - /** @hide */ - public static int networkTypeToAccessNetworkType(@TelephonyManager.NetworkType - int networkType) { - return rilRadioTechnologyToAccessNetworkType(networkTypeToRilRadioTechnology(networkType)); - } - /** * Get current data network type. * @@ -1738,36 +1730,6 @@ public class ServiceState implements Parcelable { return false; } - /** - * - * Returns whether the bearerBitmask includes a networkType that matches the accessNetworkType. - * - * The NetworkType refers to NetworkType in TelephonyManager. For example - * {@link TelephonyManager#NETWORK_TYPE_GPRS}. - * - * The accessNetworkType refers to {@link AccessNetworkType}. - * - * @hide - * */ - public static boolean networkBitmaskHasAccessNetworkType( - @TelephonyManager.NetworkTypeBitMask int networkBitmask, int accessNetworkType) { - if (networkBitmask == NETWORK_TYPE_BITMASK_UNKNOWN) return true; - if (accessNetworkType == AccessNetworkType.UNKNOWN) return false; - - int networkType = 1; - while (networkBitmask != 0) { - if ((networkBitmask & 1) != 0) { - if (networkTypeToAccessNetworkType(networkType) == accessNetworkType) { - return true; - } - } - networkBitmask = networkBitmask >> 1; - networkType++; - } - - return false; - } - /** @hide */ public static int getBitmaskForTech(int radioTech) { if (radioTech >= 1) { diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 165be641032c..116c05129a96 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -1417,6 +1417,28 @@ public class ApnSetting implements Parcelable { return port == UNSPECIFIED_INT ? null : Integer.toString(port); } + /** + * Check if this APN setting can support the given network + * + * @param networkType The network type + * @return {@code true} if this APN setting can support the given network. + * + * @hide + */ + public boolean canSupportNetworkType(@TelephonyManager.NetworkType int networkType) { + // Do a special checking for GSM. In reality, GSM is a voice only network type and can never + // be used for data. We allow it here because in some DSDS corner cases, on the non-DDS + // sub, modem reports data rat unknown. In that case if voice is GSM and this APN supports + // GPRS or EDGE, this APN setting should be selected. + if (networkType == TelephonyManager.NETWORK_TYPE_GSM + && (mNetworkTypeBitmask & (TelephonyManager.NETWORK_TYPE_BITMASK_GPRS + | TelephonyManager.NETWORK_TYPE_BITMASK_EDGE)) != 0) { + return true; + } + + return ServiceState.bitmaskHasTech(mNetworkTypeBitmask, networkType); + } + // Implement Parcelable. @Override /** @hide */ |