diff options
19 files changed, 179 insertions, 234 deletions
@@ -34,7 +34,10 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call find-other-java-files,$(FRAMEWORKS_BASE_SUBDIRS)) # EventLogTags files. -LOCAL_SRC_FILES += core/java/android/content/EventLogTags.logtags +LOCAL_SRC_FILES += \ + core/java/android/content/EventLogTags.logtags \ + core/java/android/webkit/EventLogTags.logtags \ + telephony/java/com/android/internal/telephony/EventLogTags.logtags \ # The following filters out code we are temporarily not including at all. # TODO: Move AWT and beans (and associated harmony code) back into libcore. diff --git a/core/java/android/os/ICheckinService.aidl b/core/java/android/os/ICheckinService.aidl index e5609b0..37af496 100644 --- a/core/java/android/os/ICheckinService.aidl +++ b/core/java/android/os/ICheckinService.aidl @@ -26,12 +26,6 @@ import android.os.IParentalControlCallback; * {@hide} */ interface ICheckinService { - /** Reboot into the recovery system and wipe all user data. */ - void masterClear(); - - /** Reboot into the recovery system, wipe all user data and enable Encrypted File Systems. */ - void masterClearAndToggleEFS(boolean efsEnabled); - /** * Determine if the device is under parental control. Return null if * we are unable to check the parental control status. diff --git a/core/java/android/webkit/EventLogTags.logtags b/core/java/android/webkit/EventLogTags.logtags new file mode 100644 index 0000000..082a437 --- /dev/null +++ b/core/java/android/webkit/EventLogTags.logtags @@ -0,0 +1,11 @@ +# See system/core/logcat/event.logtags for a description of the format of this file. + +option java_package android.webkit; + +# browser stats for diary study +70101 browser_zoom_level_change (start level|1|5),(end level|1|5),(time|2|3) +70102 browser_double_tap_duration (duration|1|3),(time|2|3) +# 70103- used by the browser app itself + +70150 browser_snap_center +70151 browser_text_size_change (oldSize|1|5), (newSize|1|5) diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index c021af4..39e5275 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -22,7 +22,7 @@ import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; import android.os.Message; -import android.provider.Checkin; +import android.util.EventLog; import java.lang.SecurityException; import java.util.Locale; @@ -501,8 +501,8 @@ public class WebSettings { */ public synchronized void setTextSize(TextSize t) { if (WebView.mLogEvent && mTextSize != t ) { - Checkin.updateStats(mContext.getContentResolver(), - Checkin.Stats.Tag.BROWSER_TEXT_SIZE_CHANGE, 1, 0.0); + EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE, + mTextSize.value, t.value); } mTextSize = t; postSync(); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 8fa8f09..b0233ab 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -38,7 +38,6 @@ import android.os.Handler; import android.os.Message; import android.os.ServiceManager; import android.os.SystemClock; -import android.provider.Checkin; import android.text.IClipboard; import android.text.Selection; import android.text.Spannable; @@ -623,8 +622,6 @@ public class WebView extends AbsoluteLayout private boolean mGotKeyDown; /* package */ static boolean mLogEvent = true; - private static final int EVENT_LOG_ZOOM_LEVEL_CHANGE = 70101; - private static final int EVENT_LOG_DOUBLE_TAP_DURATION = 70102; // for event log private long mLastTouchUpTime = 0; @@ -4453,7 +4450,7 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage( EventHub.UPDATE_FRAME_CACHE_IF_LOADING); if (mLogEvent && eventTime - mLastTouchUpTime < 1000) { - EventLog.writeEvent(EVENT_LOG_DOUBLE_TAP_DURATION, + EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION, (eventTime - mLastTouchUpTime), eventTime); } } @@ -5389,11 +5386,8 @@ public class WebView extends AbsoluteLayout } private void doMotionUp(int contentX, int contentY) { - if (nativeMotionUp(contentX, contentY, mNavSlop)) { - if (mLogEvent) { - Checkin.updateStats(mContext.getContentResolver(), - Checkin.Stats.Tag.BROWSER_SNAP_CENTER, 1, 0.0); - } + if (mLogEvent && nativeMotionUp(contentX, contentY, mNavSlop)) { + EventLog.writeEvent(EventLogTags.BROWSER_SNAP_CENTER); } if (nativeHasCursorNode() && !nativeCursorIsTextInput()) { playSoundEffect(SoundEffectConstants.CLICK); diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 6f57fa5..1ae736e 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1304,6 +1304,10 @@ <receiver android:name="com.android.server.MasterClearReceiver" android:permission="android.permission.MASTER_CLEAR" > <intent-filter> + <!-- For Checkin, Settings, etc.: action=MASTER_CLEAR --> + <action android:name="android.intent.action.MASTER_CLEAR" /> + + <!-- MCS always uses REMOTE_INTENT: category=MASTER_CLEAR --> <action android:name="android.intent.action.REMOTE_INTENT" /> <category android:name="android.intent.category.MASTER_CLEAR" /> </intent-filter> diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index f435ebc..dc41ff9 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -27,11 +27,11 @@ import android.content.pm.PackageManager; import android.os.BatteryManager; import android.os.Binder; import android.os.IBinder; +import android.os.DropBoxManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.UEventObserver; -import android.provider.Checkin; import android.provider.Settings; import android.util.EventLog; import android.util.Log; @@ -363,51 +363,40 @@ class BatteryService extends Binder { } private final void logBatteryStats() { - IBinder batteryInfoService = ServiceManager.getService(BATTERY_STATS_SERVICE_NAME); - if (batteryInfoService != null) { - byte[] buffer = new byte[DUMP_MAX_LENGTH]; - File dumpFile = null; - FileOutputStream dumpStream = null; - try { - // dump the service to a file - dumpFile = new File(DUMPSYS_DATA_PATH + BATTERY_STATS_SERVICE_NAME + ".dump"); - dumpStream = new FileOutputStream(dumpFile); - batteryInfoService.dump(dumpStream.getFD(), DUMPSYS_ARGS); - dumpStream.getFD().sync(); - - // read dumped file above into buffer truncated to DUMP_MAX_LENGTH - // and insert into events table. - int length = (int) Math.min(dumpFile.length(), DUMP_MAX_LENGTH); - FileInputStream fileInputStream = new FileInputStream(dumpFile); - int nread = fileInputStream.read(buffer, 0, length); - if (nread > 0) { - Checkin.logEvent(mContext.getContentResolver(), - Checkin.Events.Tag.BATTERY_DISCHARGE_INFO, - new String(buffer, 0, nread)); - if (LOCAL_LOGV) Log.v(TAG, "dumped " + nread + "b from " + - batteryInfoService + "to log"); - if (LOCAL_LOGV) Log.v(TAG, "actual dump:" + new String(buffer, 0, nread)); - } - } catch (RemoteException e) { - Log.e(TAG, "failed to dump service '" + BATTERY_STATS_SERVICE_NAME + - "':" + e); - } catch (IOException e) { - Log.e(TAG, "failed to write dumpsys file: " + e); - } finally { - // make sure we clean up - if (dumpStream != null) { - try { - dumpStream.close(); - } catch (IOException e) { - Log.e(TAG, "failed to close dumpsys output stream"); - } - } - if (dumpFile != null && !dumpFile.delete()) { - Log.e(TAG, "failed to delete temporary dumpsys file: " - + dumpFile.getAbsolutePath()); + if (batteryInfoService == null) return; + + DropBoxManager db = (DropBoxManager) mContext.getSystemService(Context.DROPBOX_SERVICE); + if (db == null || !db.isTagEnabled("BATTERY_DISCHARGE_INFO")) return; + + File dumpFile = null; + FileOutputStream dumpStream = null; + try { + // dump the service to a file + dumpFile = new File(DUMPSYS_DATA_PATH + BATTERY_STATS_SERVICE_NAME + ".dump"); + dumpStream = new FileOutputStream(dumpFile); + batteryInfoService.dump(dumpStream.getFD(), DUMPSYS_ARGS); + dumpStream.getFD().sync(); + + // add dump file to drop box + db.addFile("BATTERY_DISCHARGE_INFO", dumpFile, DropBoxManager.IS_TEXT); + } catch (RemoteException e) { + Log.e(TAG, "failed to dump battery service", e); + } catch (IOException e) { + Log.e(TAG, "failed to write dumpsys file", e); + } finally { + // make sure we clean up + if (dumpStream != null) { + try { + dumpStream.close(); + } catch (IOException e) { + Log.e(TAG, "failed to close dumpsys output stream"); } } + if (dumpFile != null && !dumpFile.delete()) { + Log.e(TAG, "failed to delete temporary dumpsys file: " + + dumpFile.getAbsolutePath()); + } } } diff --git a/services/java/com/android/server/FallbackCheckinService.java b/services/java/com/android/server/FallbackCheckinService.java index fc0ab69..195eb63 100644 --- a/services/java/com/android/server/FallbackCheckinService.java +++ b/services/java/com/android/server/FallbackCheckinService.java @@ -39,40 +39,6 @@ public final class FallbackCheckinService extends ICheckinService.Stub { mContext = context; } - public void masterClear() { - if (mContext.checkCallingOrSelfPermission("android.permission.MASTER_CLEAR") != - PackageManager.PERMISSION_GRANTED) { - Log.e(TAG, "Permission Denial: can't invoke masterClear from " - + "pid=" + Binder.getCallingPid() + ", " - + "uid=" + Binder.getCallingUid()); - return; - } - - // Save the android ID so the new system can get it erased. - try { - RecoverySystem.rebootWipeUserData(mContext); - } catch (IOException e) { - Log.e(TAG, "Reboot for masterClear() failed", e); - } - } - - public void masterClearAndToggleEFS(boolean efsEnabled) { - if (mContext.checkCallingOrSelfPermission("android.permission.MASTER_CLEAR") != - PackageManager.PERMISSION_GRANTED) { - Log.e(TAG, "Permission Denial: can't invoke masterClearAndToggleEFS from " - + "pid=" + Binder.getCallingPid() + ", " - + "uid=" + Binder.getCallingUid()); - return; - } - - // Save the android ID so the new system can get it erased. - try { - RecoverySystem.rebootToggleEFS(mContext, efsEnabled); - } catch (IOException e) { - Log.e(TAG, "Reboot for toggle EFS failed", e); - } - } - public void getParentalControlState(IParentalControlCallback p, String requestingApp) throws android.os.RemoteException { ParentalControlState state = new ParentalControlState(); diff --git a/services/java/com/android/server/MasterClearReceiver.java b/services/java/com/android/server/MasterClearReceiver.java index 3c366da..ab0eb81 100644 --- a/services/java/com/android/server/MasterClearReceiver.java +++ b/services/java/com/android/server/MasterClearReceiver.java @@ -16,16 +16,15 @@ package com.android.server; +import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.content.BroadcastReceiver; -import android.os.RemoteException; -import android.os.ICheckinService; -import android.os.ServiceManager; +import android.os.RecoverySystem; import android.util.Log; -public class MasterClearReceiver extends BroadcastReceiver { +import java.io.IOException; +public class MasterClearReceiver extends BroadcastReceiver { private static final String TAG = "MasterClear"; @Override @@ -36,18 +35,17 @@ public class MasterClearReceiver extends BroadcastReceiver { return; } } - Log.w(TAG, "!!! FACTORY RESETTING DEVICE !!!"); - ICheckinService service = - ICheckinService.Stub.asInterface( - ServiceManager.getService("checkin")); - if (service != null) { - try { - // This RPC should never return. - service.masterClear(); - } catch (RemoteException e) { - Log.w("MasterClear", - "Unable to invoke ICheckinService.masterClear()"); + + try { + Log.w(TAG, "!!! FACTORY RESET !!!"); + if (intent.hasExtra("enableEFS")) { + RecoverySystem.rebootToggleEFS(context, intent.getBooleanExtra("enableEFS", false)); + } else { + RecoverySystem.rebootWipeUserData(context); } + Log.wtf(TAG, "Still running after master clear?!"); + } catch (IOException e) { + Log.e(TAG, "Can't perform master clear/factory reset", e); } } } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 87ed252..d0f6a7c 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -92,7 +92,6 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; -import android.provider.Checkin; import android.provider.Settings; import android.text.TextUtils; import android.util.Config; @@ -966,7 +965,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen static final int IM_FEELING_LUCKY_MSG = 15; static final int LAUNCH_TIMEOUT_MSG = 16; static final int DESTROY_TIMEOUT_MSG = 17; - static final int SERVICE_ERROR_MSG = 18; static final int RESUME_TOP_ACTIVITY_MSG = 19; static final int PROC_START_TIMEOUT_MSG = 20; static final int DO_PENDING_ACTIVITY_LAUNCHES_MSG = 21; @@ -1161,13 +1159,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } } break; - case SERVICE_ERROR_MSG: { - ServiceRecord srv = (ServiceRecord)msg.obj; - // This needs to be *un*synchronized to avoid deadlock. - Checkin.logEvent(mContext.getContentResolver(), - Checkin.Events.Tag.SYSTEM_SERVICE_LOOPING, - srv.name.toShortString()); - } break; case RESUME_TOP_ACTIVITY_MSG: { synchronized (ActivityManagerService.this) { resumeTopActivityLocked(null); @@ -10767,11 +10758,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen EventLog.writeEvent(EventLogTags.AM_SCHEDULE_SERVICE_RESTART, r.shortName, r.restartDelay); - Message msg = Message.obtain(); - msg.what = SERVICE_ERROR_MSG; - msg.obj = r; - mHandler.sendMessage(msg); - return canceled; } diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index 7421854..b962375 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -22,7 +22,6 @@ import android.os.RegistrantList; import android.os.Registrant; import android.os.Handler; import android.os.AsyncResult; -import android.provider.Checkin; import android.util.Config; import android.util.Log; @@ -618,13 +617,6 @@ public abstract class BaseCommands implements CommandsInterface { return; } - if (mContext != null && - newState == RadioState.RADIO_UNAVAILABLE && - oldState != RadioState.RADIO_OFF) { - Checkin.updateStats(mContext.getContentResolver(), - Checkin.Stats.Tag.PHONE_RADIO_RESETS, 1, 0.0); - } - mRadioStateChangedRegistrants.notifyRegistrants(); if (mState.isAvailable() && !oldState.isAvailable()) { diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index a01bc09..562a9f8 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -536,8 +536,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { break; case ERR_BadDns: // Connection succeeded but DNS info is bad so disconnect - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_BAD_DNS_ADDRESS, - dnsServers[0]); + EventLog.writeEvent(EventLogTags.PDP_BAD_DNS_ADDRESS, dnsServers[0]); tearDownData(cp); transitionTo(mDisconnectingBadDnsState); break; diff --git a/telephony/java/com/android/internal/telephony/EventLogTags.logtags b/telephony/java/com/android/internal/telephony/EventLogTags.logtags new file mode 100644 index 0000000..b06c27d --- /dev/null +++ b/telephony/java/com/android/internal/telephony/EventLogTags.logtags @@ -0,0 +1,55 @@ +# See system/core/logcat/event.logtags for a description of the format of this file. + +option java_package com.android.internal.telephony; + +# PDP Context has a bad DNS address +50100 pdp_bad_dns_address (dns_address|3) + +# For data connection on PDP context, reached the data-out-without-data-in +# packet count that triggers a countdown to radio restart +50101 pdp_radio_reset_countdown_triggered (out_packet_count|1|1) + +# Radio restart - timed out with no incoming packets. +50102 pdp_radio_reset (out_packet_count|1|1) + +# PDP context reset - timed out with no incoming packets. +50103 pdp_context_reset (out_packet_count|1|1) + +# Reregister to data network - timed out with no incoming packets. +50104 pdp_reregister_network (out_packet_count|1|1) + +# PDP Setup failures +50105 pdp_setup_fail (cause|1|5), (cid|1|5), (network_type|1|5) + +# Call drops +50106 call_drop (cause|1|5), (cid|1|5), (network_type|1|5) + +# Data network registration failed after successful voice registration +50107 data_network_registration_fail (op_numeric|1|5), (cid|1|5) + +# Suspicious status of data connection while radio poweroff +50108 data_network_status_on_radio_off (dc_state|3), (enable|1|5) + +# PDP drop caused by network +50109 pdp_network_drop (cid|1|5), (network_type|1|5) + +# CDMA data network setup failure +50110 cdma_data_setup_failed (cause|1|5), (cid|1|5), (network_type|1|5) + +# CDMA data network drop +50111 cdma_data_drop (cid|1|5), (network_type|1|5) + +# GSM radio access technology switched +50112 gsm_rat_switched (cid|1|5), (network_from|1|5), (network_to|1|5) + +# GSM data connection state transition +50113 gsm_data_state_change (oldState|3), (newState|3) + +# GSM service state transition +50114 gsm_service_state_change (oldState|1|5), (oldGprsState|1|5), (newState|1|5), (newGprsState|1|5) + +# CDMA data connection state transition +50115 cdma_data_state_change (oldState|3), (newState|3) + +# CDMA service state transition +50116 cdma_service_state_change (oldState|1|5), (oldDataState|1|5), (newState|1|5), (newDataState|1|5) diff --git a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java b/telephony/java/com/android/internal/telephony/TelephonyEventLog.java deleted file mode 100644 index 0f15cb6..0000000 --- a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -/* This class contains the details related to Telephony Event Logging */ -public final class TelephonyEventLog { - - /* Event log tags */ - public static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100; - public static final int EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED = 50101; - public static final int EVENT_LOG_RADIO_RESET = 50102; - public static final int EVENT_LOG_PDP_RESET = 50103; - public static final int EVENT_LOG_REREGISTER_NETWORK = 50104; - public static final int EVENT_LOG_RADIO_PDP_SETUP_FAIL = 50105; - public static final int EVENT_LOG_CALL_DROP = 50106; - public static final int EVENT_LOG_CGREG_FAIL = 50107; - public static final int EVENT_LOG_DATA_STATE_RADIO_OFF = 50108; - public static final int EVENT_LOG_PDP_NETWORK_DROP = 50109; - public static final int EVENT_LOG_CDMA_DATA_SETUP_FAILED = 50110; - public static final int EVENT_LOG_CDMA_DATA_DROP = 50111; - public static final int EVENT_LOG_GSM_RAT_SWITCHED = 50112; -} diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index 979b8ba..fbb3c4c 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -33,7 +33,6 @@ import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; -import android.provider.Checkin; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.telephony.cdma.CdmaCellLocation; @@ -43,13 +42,13 @@ import android.util.Log; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.DataCallState; -import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnection.FailCause; +import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnectionTracker; -import com.android.internal.telephony.RetryManager; +import com.android.internal.telephony.EventLogTags; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.RetryManager; import com.android.internal.telephony.ServiceStateTracker; -import com.android.internal.telephony.TelephonyEventLog; import java.util.ArrayList; @@ -232,18 +231,10 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { protected void setState(State s) { if (DBG) log ("setState: " + s); if (state != s) { - if (s == State.INITING) { // request Data connection context - Checkin.updateStats(phone.getContext().getContentResolver(), - Checkin.Stats.Tag.PHONE_CDMA_DATA_ATTEMPTED, 1, 0.0); - } - - if (s == State.CONNECTED) { // pppd is up - Checkin.updateStats(phone.getContext().getContentResolver(), - Checkin.Stats.Tag.PHONE_CDMA_DATA_CONNECTED, 1, 0.0); - } + EventLog.writeEvent(EventLogTags.CDMA_DATA_STATE_CHANGE, + state.toString(), s.toString()); + state = s; } - - state = s; } @Override @@ -528,7 +519,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { if (mNoRecvPollCount == 0) { EventLog.writeEvent( - TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED, + EventLogTags.PDP_RADIO_RESET_COUNTDOWN_TRIGGERED, sentSinceLastRecv); } @@ -543,8 +534,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { netStatPollEnabled = false; stopNetStatPoll(); restartRadio(); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET, - NO_RECV_POLL_LIMIT); + EventLog.writeEvent(EventLogTags.PDP_RADIO_RESET, NO_RECV_POLL_LIMIT); } } else { mNoRecvPollCount = 0; @@ -822,7 +812,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { mRetryMgr.resetRetryCount(); CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_SETUP_FAILED, + EventLog.writeEvent(EventLogTags.CDMA_DATA_SETUP_FAILED, loc != null ? loc.getBaseStationId() : -1, TelephonyManager.getDefault().getNetworkType()); } @@ -863,7 +853,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { private void writeEventLogCdmaDataDrop() { CdmaCellLocation loc = (CdmaCellLocation)(phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_DROP, + EventLog.writeEvent(EventLogTags.CDMA_DATA_DROP, loc != null ? loc.getBaseStationId() : -1, TelephonyManager.getDefault().getNetworkType()); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 7f2ba47..b64e5bd 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -29,7 +29,6 @@ import android.os.Registrant; import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; -import android.provider.Checkin; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.provider.Telephony.Intents; @@ -45,10 +44,10 @@ import android.util.TimeUtils; import com.android.internal.telephony.CommandException; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.DataConnectionTracker; +import com.android.internal.telephony.EventLogTags; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.MccTable; import com.android.internal.telephony.ServiceStateTracker; -import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; @@ -537,7 +536,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { } else if (!mDesiredPowerState && cm.getRadioState().isOn()) { DataConnectionTracker dcTracker = phone.mDataConnection; if (! dcTracker.isDataConnectionAsDesired()) { - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, + EventLog.writeEvent(EventLogTags.DATA_NETWORK_STATUS_ON_RADIO_OFF, dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } @@ -1013,6 +1012,14 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { boolean hasLocationChanged = !newCellLoc.equals(cellLoc); + // Add an event log when connection state changes + if (ss.getState() != newSS.getState() || + cdmaDataConnectionState != newCdmaDataConnectionState) { + EventLog.writeEvent(EventLogTags.CDMA_SERVICE_STATE_CHANGE, + ss.getState(), cdmaDataConnectionState, + newSS.getState(), newCdmaDataConnectionState); + } + ServiceState tss; tss = ss; ss = newSS; @@ -1035,7 +1042,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { } if (hasRegistered) { - Checkin.updateStats(cr, Checkin.Stats.Tag.PHONE_CDMA_REGISTERED, 1, 0.0); networkAttachedRegistrants.notifyRegistrants(); } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java index f4b9931..87530e4 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java @@ -16,11 +16,16 @@ package com.android.internal.telephony.gsm; -import android.os.*; -import android.telephony.gsm.GsmCellLocation; +import android.os.AsyncResult; +import android.os.Handler; +import android.os.Message; +import android.os.Registrant; +import android.os.RegistrantList; +import android.os.SystemProperties; import android.telephony.PhoneNumberUtils; import android.telephony.ServiceState; import android.telephony.TelephonyManager; +import android.telephony.gsm.GsmCellLocation; import android.util.EventLog; import android.util.Log; @@ -29,13 +34,13 @@ import com.android.internal.telephony.CallTracker; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.Connection; import com.android.internal.telephony.DriverCall; +import com.android.internal.telephony.EventLogTags; +import com.android.internal.telephony.Phone; +import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.gsm.CallFailCause; +import com.android.internal.telephony.gsm.GSMPhone; import com.android.internal.telephony.gsm.GsmCall; import com.android.internal.telephony.gsm.GsmConnection; -import com.android.internal.telephony.gsm.GSMPhone; -import com.android.internal.telephony.Phone; -import com.android.internal.telephony.TelephonyEventLog; -import com.android.internal.telephony.*; import java.util.List; import java.util.ArrayList; @@ -869,7 +874,7 @@ public final class GsmCallTracker extends CallTracker { causeCode == CallFailCause.BEARER_NOT_AVAIL || causeCode == CallFailCause.ERROR_UNSPECIFIED) { GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CALL_DROP, + EventLog.writeEvent(EventLogTags.CALL_DROP, causeCode, loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType()); } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 6695ccb..1fd6be8 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -38,7 +38,6 @@ import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; -import android.provider.Checkin; import android.provider.Settings; import android.provider.Telephony; import android.telephony.ServiceState; @@ -53,7 +52,7 @@ import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnectionTracker; import com.android.internal.telephony.Phone; import com.android.internal.telephony.RetryManager; -import com.android.internal.telephony.TelephonyEventLog; +import com.android.internal.telephony.EventLogTags; import com.android.internal.telephony.DataConnection.FailCause; import java.io.IOException; @@ -301,21 +300,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected void setState(State s) { if (DBG) log ("setState: " + s); if (state != s) { - if (s == State.INITING) { // request PDP context - Checkin.updateStats( - phone.getContext().getContentResolver(), - Checkin.Stats.Tag.PHONE_GPRS_ATTEMPTED, 1, 0.0); - } - - if (s == State.CONNECTED) { // pppd is up - Checkin.updateStats( - phone.getContext().getContentResolver(), - Checkin.Stats.Tag.PHONE_GPRS_CONNECTED, 1, 0.0); - } + EventLog.writeEvent(EventLogTags.GSM_DATA_STATE_CHANGE, state.toString(), s.toString()); + state = s; } - state = s; - if (state == State.FAILED) { if (waitingApns != null) waitingApns.clear(); // when teardown the connection and set to IDLE @@ -711,7 +699,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // Add an event log when the network drops PDP GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, + EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType()); @@ -732,7 +720,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // Log the network drop on the event log. GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, + EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType()); @@ -778,11 +766,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { DEFAULT_MAX_PDP_RESET_FAIL); if (mPdpResetCount < maxPdpReset) { mPdpResetCount++; - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_RESET, sentSinceLastRecv); + EventLog.writeEvent(EventLogTags.PDP_RADIO_RESET, sentSinceLastRecv); cleanUpConnection(true, Phone.REASON_PDP_RESET); } else { mPdpResetCount = 0; - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_REREGISTER_NETWORK, sentSinceLastRecv); + EventLog.writeEvent(EventLogTags.PDP_REREGISTER_NETWORK, sentSinceLastRecv); mGsmPhone.mSST.reRegisterNetwork(null); } // TODO: Add increasingly drastic recovery steps, eg, @@ -882,7 +870,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (sentSinceLastRecv >= watchdogTrigger) { // we already have NUMBER_SENT_PACKETS sent without ack if (mNoRecvPollCount == 0) { - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED, + EventLog.writeEvent(EventLogTags.PDP_RADIO_RESET_COUNTDOWN_TRIGGERED, sentSinceLastRecv); } @@ -955,7 +943,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (status == 0) { // ping succeeded. False alarm. Reset netStatPoll. // ("-1" for this event indicates a false alarm) - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_RESET, -1); + EventLog.writeEvent(EventLogTags.PDP_RADIO_RESET, -1); mPdpResetCount = 0; sendMessage(obtainMessage(EVENT_START_NETSTAT_POLL)); } else { @@ -1145,7 +1133,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // Log this failure to the Event Logs. if (cause.isEventLoggable()) { GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_PDP_SETUP_FAIL, + EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL, cause.ordinal(), loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType()); } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 917fbfe..6352b41 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -35,7 +35,6 @@ import android.os.Registrant; import android.os.RegistrantList; import android.os.SystemClock; import android.os.SystemProperties; -import android.provider.Checkin; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.provider.Telephony.Intents; @@ -52,11 +51,11 @@ import android.util.TimeUtils; import com.android.internal.telephony.CommandException; import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.DataConnectionTracker; +import com.android.internal.telephony.EventLogTags; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.MccTable; import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.ServiceStateTracker; -import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; @@ -508,7 +507,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { // i.e. CREG is ok while CGREG is not // possible a network or baseband side error GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CGREG_FAIL, + EventLog.writeEvent(EventLogTags.DATA_NETWORK_REGISTRATION_FAIL, ss.getOperatorNumeric(), loc != null ? loc.getCid() : -1); mReportedGprsNoReg = true; } @@ -540,7 +539,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } else if (!mDesiredPowerState && cm.getRadioState().isOn()) { DataConnectionTracker dcTracker = phone.mDataConnection; if (! dcTracker.isDataConnectionAsDesired()) { - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, + EventLog.writeEvent(EventLogTags.DATA_NETWORK_STATUS_ON_RADIO_OFF, dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } // If it's on and available and we want it off gracefully @@ -889,6 +888,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker { boolean hasEmergencyOnlyChanged = mNewEmergencyOnly != mEmergencyOnly; + // Add an event log when connection state changes + if (ss.getState() != newSS.getState() || gprsState != newGPRSState) { + EventLog.writeEvent(EventLogTags.GSM_SERVICE_STATE_CHANGE, + ss.getState(), gprsState, newSS.getState(), newGPRSState); + } + ServiceState tss; tss = ss; ss = newSS; @@ -902,7 +907,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker { mEmergencyOnly = mNewEmergencyOnly; - // Add an event log when network type switched // TODO: we may add filtering to reduce the event logged, // i.e. check preferred network setting, only switch to 2G, etc @@ -910,8 +914,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { int cid = -1; GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation()); if (loc != null) cid = loc.getCid(); - EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_GSM_RAT_SWITCHED, - cid, networkType, newNetworkType); + EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, networkType, newNetworkType); Log.d(LOG_TAG, "RAT switched " + networkTypeToString(networkType) + " -> " + networkTypeToString(newNetworkType) + " at cell " + cid); @@ -928,8 +931,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } if (hasRegistered) { - Checkin.updateStats(phone.getContext().getContentResolver(), - Checkin.Stats.Tag.PHONE_GSM_REGISTERED, 1, 0.0); networkAttachedRegistrants.notifyRegistrants(); } |