Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -33422,6 +33422,7 @@ package android.telephony { method public void call(java.lang.String, java.lang.String); method public boolean canChangeDtmfToneLength(); method public int checkCarrierPrivilegesForPackage(java.lang.String); method public int checkCarrierPrivilegesForPackageAnyPhone(java.lang.String); method public void dial(java.lang.String); method public boolean disableDataConnectivity(); method public boolean enableDataConnectivity(); services/usage/java/com/android/server/usage/UsageStatsService.java +11 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.telephony.TelephonyManager; import android.util.ArraySet; import android.util.AtomicFile; import android.util.Log; Loading Loading @@ -725,6 +726,10 @@ public class UsageStatsService extends SystemService implements return false; } if (isCarrierApp(packageName)) { return false; } if (mAppWidgetManager != null && mAppWidgetManager.isBoundWidgetPackage(packageName, userId)) { return false; Loading Loading @@ -754,6 +759,12 @@ public class UsageStatsService extends SystemService implements return false; } private boolean isCarrierApp(String packageName) { TelephonyManager telephonyManager = getContext().getSystemService(TelephonyManager.class); return telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS; } void informListeners(String packageName, int userId, boolean isIdle) { for (AppIdleStateChangeListener listener : mPackageAccessListeners) { listener.onAppIdleStateChanged(packageName, userId, isIdle); Loading telephony/java/android/telephony/TelephonyManager.java +17 −2 Original line number Diff line number Diff line Loading @@ -3658,11 +3658,11 @@ public class TelephonyManager { /** @hide */ @SystemApi public int checkCarrierPrivilegesForPackage(String pkgname) { public int checkCarrierPrivilegesForPackage(String pkgName) { try { ITelephony telephony = getITelephony(); if (telephony != null) return telephony.checkCarrierPrivilegesForPackage(pkgname); return telephony.checkCarrierPrivilegesForPackage(pkgName); } catch (RemoteException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex); } catch (NullPointerException ex) { Loading @@ -3671,6 +3671,21 @@ public class TelephonyManager { return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } /** @hide */ @SystemApi public int checkCarrierPrivilegesForPackageAnyPhone(String pkgName) { try { ITelephony telephony = getITelephony(); if (telephony != null) return telephony.checkCarrierPrivilegesForPackageAnyPhone(pkgName); } catch (RemoteException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone NPE", ex); } return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } /** @hide */ @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { Loading telephony/java/com/android/internal/telephony/ITelephony.aidl +7 −2 Original line number Diff line number Diff line Loading @@ -740,9 +740,14 @@ interface ITelephony { int getCarrierPrivilegeStatus(); /** * Similar to above, but check for pkg whose name is pkgname. * Similar to above, but check for the package whose name is pkgName. */ int checkCarrierPrivilegesForPackage(String pkgname); int checkCarrierPrivilegesForPackage(String pkgName); /** * Similar to above, but check across all phones. */ int checkCarrierPrivilegesForPackageAnyPhone(String pkgName); /** * Returns list of the package names of the carrier apps that should handle the input intent Loading Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -33422,6 +33422,7 @@ package android.telephony { method public void call(java.lang.String, java.lang.String); method public boolean canChangeDtmfToneLength(); method public int checkCarrierPrivilegesForPackage(java.lang.String); method public int checkCarrierPrivilegesForPackageAnyPhone(java.lang.String); method public void dial(java.lang.String); method public boolean disableDataConnectivity(); method public boolean enableDataConnectivity();
services/usage/java/com/android/server/usage/UsageStatsService.java +11 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.telephony.TelephonyManager; import android.util.ArraySet; import android.util.AtomicFile; import android.util.Log; Loading Loading @@ -725,6 +726,10 @@ public class UsageStatsService extends SystemService implements return false; } if (isCarrierApp(packageName)) { return false; } if (mAppWidgetManager != null && mAppWidgetManager.isBoundWidgetPackage(packageName, userId)) { return false; Loading Loading @@ -754,6 +759,12 @@ public class UsageStatsService extends SystemService implements return false; } private boolean isCarrierApp(String packageName) { TelephonyManager telephonyManager = getContext().getSystemService(TelephonyManager.class); return telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS; } void informListeners(String packageName, int userId, boolean isIdle) { for (AppIdleStateChangeListener listener : mPackageAccessListeners) { listener.onAppIdleStateChanged(packageName, userId, isIdle); Loading
telephony/java/android/telephony/TelephonyManager.java +17 −2 Original line number Diff line number Diff line Loading @@ -3658,11 +3658,11 @@ public class TelephonyManager { /** @hide */ @SystemApi public int checkCarrierPrivilegesForPackage(String pkgname) { public int checkCarrierPrivilegesForPackage(String pkgName) { try { ITelephony telephony = getITelephony(); if (telephony != null) return telephony.checkCarrierPrivilegesForPackage(pkgname); return telephony.checkCarrierPrivilegesForPackage(pkgName); } catch (RemoteException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackage RemoteException", ex); } catch (NullPointerException ex) { Loading @@ -3671,6 +3671,21 @@ public class TelephonyManager { return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } /** @hide */ @SystemApi public int checkCarrierPrivilegesForPackageAnyPhone(String pkgName) { try { ITelephony telephony = getITelephony(); if (telephony != null) return telephony.checkCarrierPrivilegesForPackageAnyPhone(pkgName); } catch (RemoteException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "checkCarrierPrivilegesForPackageAnyPhone NPE", ex); } return CARRIER_PRIVILEGE_STATUS_NO_ACCESS; } /** @hide */ @SystemApi public List<String> getCarrierPackageNamesForIntent(Intent intent) { Loading
telephony/java/com/android/internal/telephony/ITelephony.aidl +7 −2 Original line number Diff line number Diff line Loading @@ -740,9 +740,14 @@ interface ITelephony { int getCarrierPrivilegeStatus(); /** * Similar to above, but check for pkg whose name is pkgname. * Similar to above, but check for the package whose name is pkgName. */ int checkCarrierPrivilegesForPackage(String pkgname); int checkCarrierPrivilegesForPackage(String pkgName); /** * Similar to above, but check across all phones. */ int checkCarrierPrivilegesForPackageAnyPhone(String pkgName); /** * Returns list of the package names of the carrier apps that should handle the input intent Loading