diff options
author | Wink Saville <wink@google.com> | 2014-06-18 16:43:14 -0700 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2014-06-22 14:41:22 +0000 |
commit | 67e0789cd3870af2fbbdefbff28f6fde9095a015 (patch) | |
tree | 337d96d1cc412a20d7f16b8b809390f5c6a33b26 | |
parent | d09692de9cb3cd26927c6d992b03c61a9885cd01 (diff) |
Mobile_radio in battery history is not accurate
Invoke TelephonyManager#listen to connect mPhoneStateListener to receive
the notifications.
Bug: 15568103
Change-Id: I5a3fa6347704e96ceb34289f74ba6e3157bbb333
-rw-r--r-- | CleanSpec.mk | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/NetworkManagementService.java | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index 1968a789da0b..b6a47f292fd6 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -202,6 +202,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes/android/app/maintenance) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes/android/app/maintenance) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/android/app/maintenance) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates) # ****************************************************************** # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java index 70222944b2a6..f9c7a78271c0 100644 --- a/services/core/java/com/android/server/NetworkManagementService.java +++ b/services/core/java/com/android/server/NetworkManagementService.java @@ -63,6 +63,7 @@ import android.os.SystemProperties; import android.telephony.DataConnectionRealTimeInfo; import android.telephony.PhoneStateListener; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.util.Log; import android.util.Slog; import android.util.SparseBooleanArray; @@ -240,15 +241,22 @@ public class NetworkManagementService extends INetworkManagementService.Stub mThread = new Thread(mConnector, NETD_TAG); mDaemonHandler = new Handler(FgThread.get().getLooper()); - mPhoneStateListener = new PhoneStateListener( - SubscriptionManager.DEFAULT_SUB_ID, // FIXME: What Subscription should be used?? + + mPhoneStateListener = new PhoneStateListener(SubscriptionManager.DEFAULT_SUB_ID, mDaemonHandler.getLooper()) { + @Override public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { + if (DBG) Slog.d(TAG, "onDataConnectionRealTimeInfoChanged: " + dcRtInfo); notifyInterfaceClassActivity(ConnectivityManager.TYPE_MOBILE, dcRtInfo.getDcPowerState(), dcRtInfo.getTime(), true); } }; + TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); + if (tm != null) { + tm.listen(mPhoneStateListener, + PhoneStateListener.LISTEN_DATA_CONNECTION_REAL_TIME_INFO); + } // Add ourself to the Watchdog monitors. Watchdog.getInstance().addMonitor(this); |