Loading proto/src/persist_atoms.proto +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ message IncomingSms { optional int32 carrier_id = 13; optional int64 message_id = 14; optional int32 count = 15; optional bool is_managed_profile = 16; // Internal use only optional int32 hashCode = 10001; Loading @@ -282,6 +283,7 @@ message OutgoingSms { optional int32 count = 15; optional int32 send_error_code = 16; optional int32 network_error_code = 17; optional bool is_managed_profile = 18; // Internal use only optional int32 hashCode = 10001; Loading src/java/com/android/internal/telephony/Phone.java +15 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.preference.PreferenceManager; import android.sysprop.TelephonyProperties; Loading Loading @@ -5134,6 +5135,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { : null; } /** * Checks if the context user is a managed profile. * * Note that this applies specifically to <em>managed</em> profiles. * * @return whether the context user is a managed profile. */ public boolean isManagedProfile() { UserHandle userHandle = getUserHandle(); UserManager userManager = mContext.getSystemService(UserManager.class); if (userHandle == null || userManager == null) return false; return userManager.isManagedProfile(userHandle.getIdentifier()); } /** * @return global null cipher and integrity enabled preference */ Loading src/java/com/android/internal/telephony/metrics/MetricsCollector.java +14 −12 Original line number Diff line number Diff line Loading @@ -483,17 +483,17 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { if (phones.length == 0) { return StatsManager.PULL_SKIP; } boolean isAutoDataSwitchOn = false; for (Phone phone : phones) { // only applies to non-DDS if (phone.getSubId() != SubscriptionManager.getDefaultDataSubscriptionId()) { isAutoDataSwitchOn = phone.getDataSettingsManager().isMobileDataPolicyEnabled( TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH); break; } } boolean isAutoDataSwitchOn = Arrays.stream(phones) .anyMatch(phone -> phone.getSubId() != SubscriptionManager.getDefaultDataSubscriptionId() && phone.getDataSettingsManager().isMobileDataPolicyEnabled( TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH)); boolean hasDedicatedManagedProfileSub = Arrays.stream(phones) .anyMatch(Phone::isManagedProfile); data.add(TelephonyStatsLog.buildStatsEvent(DEVICE_TELEPHONY_PROPERTIES, true, isAutoDataSwitchOn, mStorage.getAutoDataSwitchToggleCount())); isAutoDataSwitchOn, mStorage.getAutoDataSwitchToggleCount(), hasDedicatedManagedProfileSub)); return StatsManager.PULL_SUCCESS; } Loading Loading @@ -816,7 +816,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.isEsim, sms.carrierId, sms.messageId, sms.count); sms.count, sms.isManagedProfile); } private static StatsEvent buildStatsEvent(OutgoingSms sms) { Loading @@ -838,7 +839,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.intervalMillis, sms.count, sms.sendErrorCode, sms.networkErrorCode); sms.networkErrorCode, sms.isManagedProfile); } private static StatsEvent buildStatsEvent(DataCallSession dataCallSession) { Loading src/java/com/android/internal/telephony/metrics/SmsStats.java +2 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,7 @@ public class SmsStats { // SMS messages (e.g. those handled by OS or error cases). proto.messageId = RANDOM.nextLong(); proto.count = 1; proto.isManagedProfile = mPhone.isManagedProfile(); return proto; } Loading @@ -258,6 +259,7 @@ public class SmsStats { proto.retryId = 0; proto.intervalMillis = intervalMillis; proto.count = 1; proto.isManagedProfile = mPhone.isManagedProfile(); return proto; } Loading Loading
proto/src/persist_atoms.proto +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ message IncomingSms { optional int32 carrier_id = 13; optional int64 message_id = 14; optional int32 count = 15; optional bool is_managed_profile = 16; // Internal use only optional int32 hashCode = 10001; Loading @@ -282,6 +283,7 @@ message OutgoingSms { optional int32 count = 15; optional int32 send_error_code = 16; optional int32 network_error_code = 17; optional bool is_managed_profile = 18; // Internal use only optional int32 hashCode = 10001; Loading
src/java/com/android/internal/telephony/Phone.java +15 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.preference.PreferenceManager; import android.sysprop.TelephonyProperties; Loading Loading @@ -5134,6 +5135,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { : null; } /** * Checks if the context user is a managed profile. * * Note that this applies specifically to <em>managed</em> profiles. * * @return whether the context user is a managed profile. */ public boolean isManagedProfile() { UserHandle userHandle = getUserHandle(); UserManager userManager = mContext.getSystemService(UserManager.class); if (userHandle == null || userManager == null) return false; return userManager.isManagedProfile(userHandle.getIdentifier()); } /** * @return global null cipher and integrity enabled preference */ Loading
src/java/com/android/internal/telephony/metrics/MetricsCollector.java +14 −12 Original line number Diff line number Diff line Loading @@ -483,17 +483,17 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { if (phones.length == 0) { return StatsManager.PULL_SKIP; } boolean isAutoDataSwitchOn = false; for (Phone phone : phones) { // only applies to non-DDS if (phone.getSubId() != SubscriptionManager.getDefaultDataSubscriptionId()) { isAutoDataSwitchOn = phone.getDataSettingsManager().isMobileDataPolicyEnabled( TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH); break; } } boolean isAutoDataSwitchOn = Arrays.stream(phones) .anyMatch(phone -> phone.getSubId() != SubscriptionManager.getDefaultDataSubscriptionId() && phone.getDataSettingsManager().isMobileDataPolicyEnabled( TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH)); boolean hasDedicatedManagedProfileSub = Arrays.stream(phones) .anyMatch(Phone::isManagedProfile); data.add(TelephonyStatsLog.buildStatsEvent(DEVICE_TELEPHONY_PROPERTIES, true, isAutoDataSwitchOn, mStorage.getAutoDataSwitchToggleCount())); isAutoDataSwitchOn, mStorage.getAutoDataSwitchToggleCount(), hasDedicatedManagedProfileSub)); return StatsManager.PULL_SUCCESS; } Loading Loading @@ -816,7 +816,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.isEsim, sms.carrierId, sms.messageId, sms.count); sms.count, sms.isManagedProfile); } private static StatsEvent buildStatsEvent(OutgoingSms sms) { Loading @@ -838,7 +839,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.intervalMillis, sms.count, sms.sendErrorCode, sms.networkErrorCode); sms.networkErrorCode, sms.isManagedProfile); } private static StatsEvent buildStatsEvent(DataCallSession dataCallSession) { Loading
src/java/com/android/internal/telephony/metrics/SmsStats.java +2 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,7 @@ public class SmsStats { // SMS messages (e.g. those handled by OS or error cases). proto.messageId = RANDOM.nextLong(); proto.count = 1; proto.isManagedProfile = mPhone.isManagedProfile(); return proto; } Loading @@ -258,6 +259,7 @@ public class SmsStats { proto.retryId = 0; proto.intervalMillis = intervalMillis; proto.count = 1; proto.isManagedProfile = mPhone.isManagedProfile(); return proto; } Loading