From a4bd83ad639b349fa16dbd07225017fcbf6ed550 Mon Sep 17 00:00:00 2001 From: Chiao Cheng Date: Tue, 20 Aug 2013 17:32:18 -0700 Subject: Protect all logging statements. - Rename global logger so it can be a drop in replacement for framework log class. - Remove imports of android.util.Log Bug: 10411948 Change-Id: I377625263b16c4f9408c79d5c533a1810fa6cde7 --- .../src/com/android/incallui/AnimationUtils.java | 1 - .../src/com/android/incallui/AnswerFragment.java | 4 +- .../src/com/android/incallui/AnswerPresenter.java | 8 +- .../com/android/incallui/CallButtonFragment.java | 40 ++++----- .../com/android/incallui/CallButtonPresenter.java | 22 +++-- .../src/com/android/incallui/CallCardFragment.java | 9 +- .../com/android/incallui/CallCardPresenter.java | 19 ++--- .../com/android/incallui/CallCommandClient.java | 49 ++++++----- .../com/android/incallui/CallHandlerService.java | 33 ++++---- InCallUI/src/com/android/incallui/CallList.java | 18 ++-- InCallUI/src/com/android/incallui/CallerInfo.java | 43 +++++----- .../com/android/incallui/CallerInfoAsyncQuery.java | 40 ++++----- .../src/com/android/incallui/CallerInfoUtils.java | 15 ++-- .../src/com/android/incallui/ContactInfoCache.java | 32 +++---- .../com/android/incallui/ContactsAsyncHelper.java | 17 ++-- .../src/com/android/incallui/DialpadFragment.java | 6 +- .../src/com/android/incallui/DialpadPresenter.java | 8 +- .../src/com/android/incallui/GlowPadWrapper.java | 14 ++-- .../src/com/android/incallui/InCallActivity.java | 25 +++--- InCallUI/src/com/android/incallui/InCallApp.java | 2 +- .../src/com/android/incallui/InCallPresenter.java | 23 ++--- InCallUI/src/com/android/incallui/Log.java | 96 +++++++++++++++++++++ InCallUI/src/com/android/incallui/Logger.java | 97 ---------------------- .../com/android/incallui/StatusBarNotifier.java | 23 +++-- .../src/com/android/incallui/util/HttpFetcher.java | 2 +- 25 files changed, 312 insertions(+), 334 deletions(-) create mode 100644 InCallUI/src/com/android/incallui/Log.java delete mode 100644 InCallUI/src/com/android/incallui/Logger.java (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/AnimationUtils.java b/InCallUI/src/com/android/incallui/AnimationUtils.java index 2bf730cca..aef3cdfb6 100644 --- a/InCallUI/src/com/android/incallui/AnimationUtils.java +++ b/InCallUI/src/com/android/incallui/AnimationUtils.java @@ -23,7 +23,6 @@ import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.util.Log; import android.view.View; import android.view.ViewPropertyAnimator; import android.widget.ImageView; diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java index aea80eced..077eaac42 100644 --- a/InCallUI/src/com/android/incallui/AnswerFragment.java +++ b/InCallUI/src/com/android/incallui/AnswerFragment.java @@ -159,9 +159,9 @@ public class AnswerFragment extends BaseFragment } else { getUi().showTextButton(false); } - Logger.d(this, "Showing incoming with: " + mCall); + Log.d(this, "Showing incoming with: " + mCall); } else { getUi().showAnswerUi(false); mCall = null; @@ -60,7 +60,7 @@ public class AnswerPresenter extends Presenter return; } - Logger.d(this, "onAnswer " + mCall.getCallId()); + Log.d(this, "onAnswer " + mCall.getCallId()); CallCommandClient.getInstance().answerCall(mCall.getCallId()); } @@ -70,7 +70,7 @@ public class AnswerPresenter extends Presenter return; } - Logger.d(this, "onDecline " + mCall.getCallId()); + Log.d(this, "onDecline " + mCall.getCallId()); CallCommandClient.getInstance().rejectCall(mCall.getCallId(), false, null); } @@ -80,7 +80,7 @@ public class AnswerPresenter extends Presenter } public void rejectCallWithMessage(String message) { - Logger.d(this, "sendTextToDefaultActivity()..."); + Log.d(this, "sendTextToDefaultActivity()..."); CallCommandClient.getInstance().rejectCall(mCall.getCallId(), true, message); getUi().dismissPopup(); } diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 15d044684..a1592924b 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -139,7 +139,7 @@ public class CallButtonFragment @Override public void onClick(View view) { int id = view.getId(); - Logger.d(this, "onClick(View " + view + ", id " + id + ")..."); + Log.d(this, "onClick(View " + view + ", id " + id + ")..."); switch(id) { case R.id.addButton: @@ -155,7 +155,7 @@ public class CallButtonFragment getPresenter().showDialpadClicked(mShowDialpadButton.isChecked()); break; default: - Logger.wtf(this, "onClick: unexpected"); + Log.wtf(this, "onClick: unexpected"); break; } } @@ -211,9 +211,9 @@ public class CallButtonFragment @Override public boolean onMenuItemClick(MenuItem item) { - Logger.d(this, "- onMenuItemClick: " + item); - Logger.d(this, " id: " + item.getItemId()); - Logger.d(this, " title: '" + item.getTitle() + "'"); + Log.d(this, "- onMenuItemClick: " + item); + Log.d(this, " id: " + item.getItemId()); + Log.d(this, " title: '" + item.getTitle() + "'"); int mode = AudioMode.WIRED_OR_EARPIECE; @@ -231,7 +231,7 @@ public class CallButtonFragment mode = AudioMode.BLUETOOTH; break; default: - Logger.e(this, "onMenuItemClick: unexpected View ID " + item.getItemId() + Log.e(this, "onMenuItemClick: unexpected View ID " + item.getItemId() + " (MenuItem = '" + item + "')"); break; } @@ -247,7 +247,7 @@ public class CallButtonFragment // of the menu items. @Override public void onDismiss(PopupMenu menu) { - Logger.d(this, "- onDismiss: " + menu); + Log.d(this, "- onDismiss: " + menu); mAudioModePopupVisible = false; } @@ -256,7 +256,7 @@ public class CallButtonFragment * pop up menu. Otherwise, it toggles the speakerphone. */ private void onAudioButtonClicked() { - Logger.d(this, "onAudioButtonClicked: " + + Log.d(this, "onAudioButtonClicked: " + AudioMode.toString(getPresenter().getSupportedAudio())); if (isSupported(AudioMode.BLUETOOTH)) { @@ -304,7 +304,7 @@ public class CallButtonFragment boolean showToggleIndicator = false; if (bluetoothSupported) { - Logger.d(this, "updateAudioButtons - popup menu mode"); + Log.d(this, "updateAudioButtons - popup menu mode"); audioButtonEnabled = true; showMoreIndicator = true; @@ -325,7 +325,7 @@ public class CallButtonFragment // earpiece" icon. (Still need an asset for that, though.) } } else if (speakerSupported) { - Logger.d(this, "updateAudioButtons - speaker toggle mode"); + Log.d(this, "updateAudioButtons - speaker toggle mode"); audioButtonEnabled = true; @@ -339,7 +339,7 @@ public class CallButtonFragment showSpeakerphoneOnIcon = isAudio(AudioMode.SPEAKER); showSpeakerphoneOffIcon = !showSpeakerphoneOnIcon; } else { - Logger.d(this, "updateAudioButtons - disabled..."); + Log.d(this, "updateAudioButtons - disabled..."); // The audio button is a toggle in this state, but that's mostly // irrelevant since it's always disabled and unchecked. @@ -353,13 +353,13 @@ public class CallButtonFragment // Finally, update it all! - Logger.v(this, "audioButtonEnabled: " + audioButtonEnabled); - Logger.v(this, "audioButtonChecked: " + audioButtonChecked); - Logger.v(this, "showMoreIndicator: " + showMoreIndicator); - Logger.v(this, "showBluetoothIcon: " + showBluetoothIcon); - Logger.v(this, "showSpeakerphoneOnIcon: " + showSpeakerphoneOnIcon); - Logger.v(this, "showSpeakerphoneOffIcon: " + showSpeakerphoneOffIcon); - Logger.v(this, "showHandsetIcon: " + showHandsetIcon); + Log.v(this, "audioButtonEnabled: " + audioButtonEnabled); + Log.v(this, "audioButtonChecked: " + audioButtonChecked); + Log.v(this, "showMoreIndicator: " + showMoreIndicator); + Log.v(this, "showBluetoothIcon: " + showBluetoothIcon); + Log.v(this, "showSpeakerphoneOnIcon: " + showSpeakerphoneOnIcon); + Log.v(this, "showSpeakerphoneOffIcon: " + showSpeakerphoneOffIcon); + Log.v(this, "showHandsetIcon: " + showHandsetIcon); // Constants for Drawable.setAlpha() final int HIDDEN = 0; @@ -369,7 +369,7 @@ public class CallButtonFragment mAudioButton.setChecked(audioButtonChecked); final LayerDrawable layers = (LayerDrawable) mAudioButton.getBackground(); - Logger.d(this, "'layers' drawable: " + layers); + Log.d(this, "'layers' drawable: " + layers); layers.findDrawableByLayerId(R.id.compoundBackgroundItem) .setAlpha(showToggleIndicator ? VISIBLE : HIDDEN); @@ -391,7 +391,7 @@ public class CallButtonFragment } private void showAudioModePopup() { - Logger.d(this, "showAudioPopup()..."); + Log.d(this, "showAudioPopup()..."); mAudioModePopup = new PopupMenu(getView().getContext(), mAudioButton /* anchorView */); mAudioModePopup.getMenuInflater().inflate(R.menu.incall_audio_mode_menu, diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 233231754..3a2d719e9 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -16,8 +16,6 @@ package com.android.incallui; -import android.media.AudioManager; - import com.android.incallui.AudioModeProvider.AudioModeListener; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; @@ -97,7 +95,7 @@ public class CallButtonPresenter extends Presenter @Override public void onStateChange(InCallState state, CallList callList) { - Logger.d(TAG, "onStateChange()"); + Log.d(TAG, "onStateChange()"); final CallCardUi ui = getUi(); if (ui == null) { return; @@ -122,8 +115,8 @@ public class CallCardPresenter extends Presenter secondary = getCallToDisplay(callList, primary, true); } - Logger.d(this, "Primary call: " + primary); - Logger.d(this, "Secondary call: " + secondary); + Log.d(this, "Primary call: " + primary); + Log.d(this, "Secondary call: " + secondary); mPrimary = primary; mSecondary = secondary; @@ -136,10 +129,10 @@ public class CallCardPresenter extends Presenter // Start/Stop the call time update timer if (mPrimary != null && mPrimary.getState() == Call.State.ACTIVE) { - Logger.d(this, "Starting the calltime timer"); + Log.d(this, "Starting the calltime timer"); mCallTimer.start(CALL_TIME_UPDATE_INTERVAL); } else { - Logger.d(this, "Canceling the calltime timer"); + Log.d(this, "Canceling the calltime timer"); mCallTimer.cancel(); ui.setPrimaryCallElapsedTime(false, null); } @@ -318,7 +311,7 @@ public class CallCardPresenter extends Presenter final byte[] image = HttpFetcher.getRequestAsByteArray(url); return BitmapFactory.decodeByteArray(image, 0, image.length); } catch (IOException e) { - Logger.e(TAG, "Unable to download/decode photo.", e); + Log.e(TAG, "Unable to download/decode photo.", e); } return null; } diff --git a/InCallUI/src/com/android/incallui/CallCommandClient.java b/InCallUI/src/com/android/incallui/CallCommandClient.java index 308776cb6..621bb2a4f 100644 --- a/InCallUI/src/com/android/incallui/CallCommandClient.java +++ b/InCallUI/src/com/android/incallui/CallCommandClient.java @@ -18,7 +18,6 @@ package com.android.incallui; import android.os.RemoteException; -import com.android.internal.util.Preconditions; import com.android.services.telephony.common.ICallCommandService; /** @@ -46,136 +45,136 @@ public class CallCommandClient { public void answerCall(int callId) { if (mCommandService == null) { - Logger.e(this, "Cannot answer call; CallCommandService == null"); + Log.e(this, "Cannot answer call; CallCommandService == null"); return; } try { mCommandService.answerCall(callId); } catch (RemoteException e) { - Logger.e(this, "Error answering call.", e); + Log.e(this, "Error answering call.", e); } } public void rejectCall(int callId, boolean rejectWithMessage, String message) { if (mCommandService == null) { - Logger.e(this, "Cannot reject call; CallCommandService == null"); + Log.e(this, "Cannot reject call; CallCommandService == null"); return; } try { mCommandService.rejectCall(callId, rejectWithMessage, message); } catch (RemoteException e) { - Logger.e(this, "Error rejecting call.", e); + Log.e(this, "Error rejecting call.", e); } } public void disconnectCall(int callId) { if (mCommandService == null) { - Logger.e(this, "Cannot disconnect call; CallCommandService == null"); + Log.e(this, "Cannot disconnect call; CallCommandService == null"); return; } try { mCommandService.disconnectCall(callId); } catch (RemoteException e) { - Logger.e(this, "Error answering call.", e); + Log.e(this, "Error answering call.", e); } } public void mute(boolean onOff) { if (mCommandService == null) { - Logger.e(this, "Cannot mute call; CallCommandService == null"); + Log.e(this, "Cannot mute call; CallCommandService == null"); return; } try { mCommandService.mute(onOff); } catch (RemoteException e) { - Logger.e(this, "Error muting phone.", e); + Log.e(this, "Error muting phone.", e); } } public void hold(int callId, boolean onOff) { if (mCommandService == null) { - Logger.e(this, "Cannot hold call; CallCommandService == null"); + Log.e(this, "Cannot hold call; CallCommandService == null"); return; } try { mCommandService.hold(callId, onOff); } catch (RemoteException e) { - Logger.e(this, "Error holding call.", e); + Log.e(this, "Error holding call.", e); } } public void merge() { if (mCommandService == null) { - Logger.e(this, "Cannot merge call; CallCommandService == null"); + Log.e(this, "Cannot merge call; CallCommandService == null"); return; } try { mCommandService.merge(); } catch (RemoteException e) { - Logger.e(this, "Error merging calls.", e); + Log.e(this, "Error merging calls.", e); } } public void swap() { if (mCommandService == null) { - Logger.e(this, "Cannot swap call; CallCommandService == null"); + Log.e(this, "Cannot swap call; CallCommandService == null"); return; } try { mCommandService.swap(); } catch (RemoteException e) { - Logger.e(this, "Error merging calls.", e); + Log.e(this, "Error merging calls.", e); } } public void addCall() { if (mCommandService == null) { - Logger.e(this, "Cannot add call; CallCommandService == null"); + Log.e(this, "Cannot add call; CallCommandService == null"); return; } try { mCommandService.addCall(); } catch (RemoteException e) { - Logger.e(this, "Error merging calls.", e); + Log.e(this, "Error merging calls.", e); } } public void setAudioMode(int mode) { if (mCommandService == null) { - Logger.e(this, "Cannot set audio mode; CallCommandService == null"); + Log.e(this, "Cannot set audio mode; CallCommandService == null"); return; } try { mCommandService.setAudioMode(mode); } catch (RemoteException e) { - Logger.e(this, "Error setting speaker.", e); + Log.e(this, "Error setting speaker.", e); } } public void playDtmfTone(char digit, boolean timedShortTone) { if (mCommandService == null) { - Logger.e(this, "Cannot start dtmf tone; CallCommandService == null"); + Log.e(this, "Cannot start dtmf tone; CallCommandService == null"); return; } try { - Logger.v(this, "Sending dtmf tone " + digit); + Log.v(this, "Sending dtmf tone " + digit); mCommandService.playDtmfTone(digit, timedShortTone); } catch (RemoteException e) { - Logger.e(this, "Error setting speaker.", e); + Log.e(this, "Error setting speaker.", e); } } public void stopDtmfTone() { if (mCommandService == null) { - Logger.e(this, "Cannot stop dtmf tone; CallCommandService == null"); + Log.e(this, "Cannot stop dtmf tone; CallCommandService == null"); return; } try { - Logger.v(this, "Stop dtmf tone "); + Log.v(this, "Stop dtmf tone "); mCommandService.stopDtmfTone(); } catch (RemoteException e) { - Logger.e(this, "Error setting speaker.", e); + Log.e(this, "Error setting speaker.", e); } } } diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index f0df1cdc0..150935075 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -28,7 +28,6 @@ import com.android.services.telephony.common.ICallCommandService; import com.android.services.telephony.common.ICallHandlerService; import java.util.AbstractMap; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -54,7 +53,7 @@ public class CallHandlerService extends Service { @Override public void onCreate() { - Logger.d(this, "onCreate started"); + Log.d(this, "onCreate started"); super.onCreate(); mCallList = new CallList(); @@ -62,12 +61,12 @@ public class CallHandlerService extends Service { mAudioModeProvider = new AudioModeProvider(); mInCallPresenter = InCallPresenter.getInstance(); mInCallPresenter.setUp(getApplicationContext(), mCallList, mAudioModeProvider); - Logger.d(this, "onCreate finished"); + Log.d(this, "onCreate finished"); } @Override public void onDestroy() { - Logger.d(this, "onDestroy started"); + Log.d(this, "onDestroy started"); // Remove all pending messages before nulling out handler for (int i = 1; i <= LARGEST_MSG_ID; i++) { @@ -87,18 +86,18 @@ public class CallHandlerService extends Service { mInCallPresenter = null; mAudioModeProvider = null; - Logger.d(this, "onDestroy finished"); + Log.d(this, "onDestroy finished"); } @Override public IBinder onBind(Intent intent) { - Logger.d(this, "onBind"); + Log.d(this, "onBind"); return mBinder; } @Override public boolean onUnbind(Intent intent) { - Logger.d(this, "onUnbind"); + Log.d(this, "onUnbind"); return true; } @@ -106,19 +105,19 @@ public class CallHandlerService extends Service { @Override public void setCallCommandService(ICallCommandService service) { - Logger.d(CallHandlerService.this, "onConnected: " + service.toString()); + Log.d(CallHandlerService.this, "onConnected: " + service.toString()); CallCommandClient.getInstance().setService(service); } @Override public void onDisconnect(Call call) { - Logger.d(CallHandlerService.this, "onDisconnected: " + call); + Log.d(CallHandlerService.this, "onDisconnected: " + call); mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_DISCONNECT_CALL, 0, 0, call)); } @Override public void onIncoming(Call call, List textResponses) { - Logger.d(CallHandlerService.this, "onIncomingCall: " + call); + Log.d(CallHandlerService.this, "onIncomingCall: " + call); // TODO(klp): Add text responses to the call object. Map.Entry > incomingCall = new AbstractMap.SimpleEntry calls, boolean fullUpdate) { - Logger.d(CallHandlerService.this, "onUpdate " + calls.toString()); + Log.d(CallHandlerService.this, "onUpdate " + calls.toString()); - if (Logger.VERBOSE) { + if (Log.VERBOSE) { for (Call c : calls) { - Logger.v(this, "Call: " + c); + Log.v(this, "Call: " + c); } } @@ -143,13 +142,13 @@ public class CallHandlerService extends Service { @Override public void onAudioModeChange(int mode) { - Logger.d(CallHandlerService.this, "onAudioModeChange : " + AudioMode.toString(mode)); + Log.d(CallHandlerService.this, "onAudioModeChange : " + AudioMode.toString(mode)); mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode, 0, null)); } @Override public void onSupportedAudioModeChange(int modeMask) { - Logger.d(CallHandlerService.this, "onSupportedAudioModeChange : " + + Log.d(CallHandlerService.this, "onSupportedAudioModeChange : " + AudioMode.toString(modeMask)); mMainHandler.sendMessage( @@ -176,10 +175,10 @@ public class CallHandlerService extends Service { if (msg.what > LARGEST_MSG_ID) { // If you got here, you may have added a new message and forgotten to // update LARGEST_MSG_ID - Logger.wtf(this, "Cannot handle message larger than LARGEST_MSG_ID."); + Log.wtf(this, "Cannot handle message larger than LARGEST_MSG_ID."); } - Logger.d(this, "executeMessage " + msg.what); + Log.d(this, "executeMessage " + msg.what); switch (msg.what) { case ON_UPDATE_CALL: diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index a3cee5f98..7890b997a 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -16,12 +16,9 @@ package com.android.incallui; -import com.google.android.collect.Lists; import com.google.android.collect.Maps; import com.google.android.collect.Sets; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import android.os.Handler; import android.os.Message; @@ -32,7 +29,6 @@ import java.util.AbstractMap; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Set; /** @@ -73,7 +69,7 @@ public class CallList { * Called when a single call has changed. */ public void onUpdate(Call call) { - Logger.d(this, "onUpdate - ", call); + Log.d(this, "onUpdate - ", call); updateCallInMap(call); notifyListenersOfChange(); @@ -83,7 +79,7 @@ public class CallList { * Called when a single call disconnects. */ public void onDisconnect(Call call) { - Logger.d(this, "onDisconnect: ", call); + Log.d(this, "onDisconnect: ", call); updateCallInMap(call); @@ -94,7 +90,7 @@ public class CallList { * Called when a single call has changed. */ public void onUpdate(AbstractMap.SimpleEntry > incomingCall) { - Logger.d(this, "onUpdate - " + incomingCall.getKey()); + Log.d(this, "onUpdate - " + incomingCall.getKey()); updateCallInMap(incomingCall.getKey()); updateCallTextMap(incomingCall.getKey(), incomingCall.getValue()); @@ -106,11 +102,11 @@ public class CallList { * Called when multiple calls have changed. */ public void onUpdate(List callsToUpdate) { - Logger.d(this, "onUpdate(...)"); + Log.d(this, "onUpdate(...)"); Preconditions.checkNotNull(callsToUpdate); for (Call call : callsToUpdate) { - Logger.d(this, "\t" + call); + Log.d(this, "\t" + call); updateCallInMap(call); updateCallTextMap(call, null); @@ -315,11 +311,11 @@ public class CallList { public void handleMessage(Message msg) { switch (msg.what) { case EVENT_DISCONNECTED_TIMEOUT: - Logger.d(this, "EVENT_DISCONNECTED_TIMEOUT ", msg.obj); + Log.d(this, "EVENT_DISCONNECTED_TIMEOUT ", msg.obj); finishDisconnectedCall((Call) msg.obj); break; default: - Logger.wtf(this, "Message not expected: " + msg.what); + Log.wtf(this, "Message not expected: " + msg.what); break; } } diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java index 323e276b2..3bad9f47c 100644 --- a/InCallUI/src/com/android/incallui/CallerInfo.java +++ b/InCallUI/src/com/android/incallui/CallerInfo.java @@ -29,7 +29,6 @@ import android.provider.ContactsContract.RawContacts; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.text.TextUtils; -import android.util.Log; import com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder; import com.android.i18n.phonenumbers.NumberParseException; @@ -159,7 +158,7 @@ public class CallerInfo { info.isCachedPhotoCurrent = false; info.contactExists = false; - Logger.v(TAG, "getCallerInfo() based on cursor..."); + Log.v(TAG, "getCallerInfo() based on cursor..."); if (cursor != null) { if (cursor.moveToFirst()) { @@ -204,10 +203,10 @@ public class CallerInfo { columnIndex = getColumnIndexForPersonId(contactRef, cursor); if (columnIndex != -1) { info.person_id = cursor.getLong(columnIndex); - Logger.v(TAG, "==> got info.person_id: " + info.person_id); + Log.v(TAG, "==> got info.person_id: " + info.person_id); } else { // No valid columnIndex, so we can't look up person_id. - Logger.v(TAG, "Couldn't find person_id column for " + contactRef); + Log.v(TAG, "Couldn't find person_id column for " + contactRef); // Watch out: this means that anything that depends on // person_id will be broken (like contact photo lookups in // the in-call UI, for example.) @@ -264,7 +263,7 @@ public class CallerInfo { * with all relevant fields empty or null. */ public static CallerInfo getCallerInfo(Context context, String number) { - Logger.v(TAG, "getCallerInfo() based on number..."); + Log.v(TAG, "getCallerInfo() based on number..."); if (TextUtils.isEmpty(number)) { return null; @@ -409,7 +408,7 @@ public class CallerInfo { // permission to retrieve VM number and would not call // this method. // Leave phoneNumber untouched. - Logger.e(TAG, "Cannot access VoiceMail.", se); + Log.e(TAG, "Cannot access VoiceMail.", se); } // TODO: There is no voicemail picture? // FIXME: FIND ANOTHER ICON @@ -468,8 +467,8 @@ public class CallerInfo { // So instead, figure out the column to use for person_id by just // looking at the URI itself. - Logger.v(TAG, "- getColumnIndexForPersonId: contactRef URI = '" - + contactRef + "'..."); + Log.v(TAG, "- getColumnIndexForPersonId: contactRef URI = '" + + contactRef + "'..."); // Warning: Do not enable the following logging (due to ANR risk.) // if (VDBG) Rlog.v(TAG, "- MIME type: " // + context.getContentResolver().getType(contactRef)); @@ -479,26 +478,26 @@ public class CallerInfo { if (url.startsWith("content://com.android.contacts/data/phones")) { // Direct lookup in the Phone table. // MIME type: Phone.CONTENT_ITEM_TYPE (= "vnd.android.cursor.item/phone_v2") - Logger.v(TAG, "'data/phones' URI; using RawContacts.CONTACT_ID"); + Log.v(TAG, "'data/phones' URI; using RawContacts.CONTACT_ID"); columnName = RawContacts.CONTACT_ID; } else if (url.startsWith("content://com.android.contacts/data")) { // Direct lookup in the Data table. // MIME type: Data.CONTENT_TYPE (= "vnd.android.cursor.dir/data") - Logger.v(TAG, "'data' URI; using Data.CONTACT_ID"); + Log.v(TAG, "'data' URI; using Data.CONTACT_ID"); // (Note Data.CONTACT_ID and RawContacts.CONTACT_ID are equivalent.) columnName = Data.CONTACT_ID; } else if (url.startsWith("content://com.android.contacts/phone_lookup")) { // Lookup in the PhoneLookup table, which provides "fuzzy matching" // for phone numbers. // MIME type: PhoneLookup.CONTENT_TYPE (= "vnd.android.cursor.dir/phone_lookup") - Logger.v(TAG, "'phone_lookup' URI; using PhoneLookup._ID"); + Log.v(TAG, "'phone_lookup' URI; using PhoneLookup._ID"); columnName = PhoneLookup._ID; } else { - Logger.v(TAG, "Unexpected prefix for contactRef '" + url + "'"); + Log.v(TAG, "Unexpected prefix for contactRef '" + url + "'"); } int columnIndex = (columnName != null) ? cursor.getColumnIndex(columnName) : -1; - Logger.v(TAG, "==> Using column '" + columnName - + "' (columnIndex = " + columnIndex + ") for person_id lookup..."); + Log.v(TAG, "==> Using column '" + columnName + + "' (columnIndex = " + columnIndex + ") for person_id lookup..."); return columnIndex; } @@ -524,7 +523,7 @@ public class CallerInfo { * @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder */ private static String getGeoDescription(Context context, String number) { - Logger.v(TAG, "getGeoDescription('" + number + "')..."); + Log.v(TAG, "getGeoDescription('" + number + "')..."); if (TextUtils.isEmpty(number)) { return null; @@ -537,18 +536,18 @@ public class CallerInfo { String countryIso = getCurrentCountryIso(context, locale); PhoneNumber pn = null; try { - Logger.v(TAG, "parsing '" + number - + "' for countryIso '" + countryIso + "'..."); + Log.v(TAG, "parsing '" + number + + "' for countryIso '" + countryIso + "'..."); pn = util.parse(number, countryIso); - Logger.v(TAG, "- parsed number: " + pn); + Log.v(TAG, "- parsed number: " + pn); } catch (NumberParseException e) { - Logger.v(TAG, "getGeoDescription: NumberParseException for incoming number '" + + Log.v(TAG, "getGeoDescription: NumberParseException for incoming number '" + number + "'"); } if (pn != null) { String description = geocoder.getDescriptionForNumber(pn, locale); - Logger.v(TAG, "- got description: '" + description + "'"); + Log.v(TAG, "- got description: '" + description + "'"); return description; } else { return null; @@ -567,8 +566,8 @@ public class CallerInfo { countryIso = detector.detectCountry().getCountryIso(); } else { countryIso = locale.getCountry(); - Logger.v(TAG, "No CountryDetector; falling back to countryIso based on locale: " - + countryIso); + Log.v(TAG, "No CountryDetector; falling back to countryIso based on locale: " + + countryIso); } return countryIso; } diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java index 3ebad5edb..c9d282b25 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java +++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java @@ -25,7 +25,6 @@ import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.os.SystemProperties; import android.provider.ContactsContract.CommonDataKinds.SipAddress; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; @@ -135,14 +134,15 @@ public class CallerInfoAsyncQuery { // However, if there is any code that this Handler calls (such as in // super.handleMessage) that DOES place unexpected messages on the // queue, then we need pass these messages on. - Logger.d(this, "Unexpected command (CookieWrapper is null): " + msg.what + + Log.d(this, "Unexpected command (CookieWrapper is null): " + msg.what + " ignored by CallerInfoWorkerHandler, passing onto parent."); super.handleMessage(msg); } else { - Logger.d(this, "Processing event: " + cw.event + " token (arg1): " + msg.arg1 + - " command: " + msg.what + " query URI: " + sanitizeUriToString(args.uri)); + Log.d(this, "Processing event: " + cw.event + " token (arg1): " + msg.arg1 + + " command: " + msg.what + " query URI: " + + sanitizeUriToString(args.uri)); switch (cw.event) { case EVENT_NEW_QUERY: @@ -197,7 +197,7 @@ public class CallerInfoAsyncQuery { */ @Override protected void onQueryComplete(int token, Object cookie, Cursor cursor) { - Logger.d(this, "##### onQueryComplete() ##### query complete for token: " + token); + Log.d(this, "##### onQueryComplete() ##### query complete for token: " + token); //get the cookie and notify the listener. CookieWrapper cw = (CookieWrapper) cookie; @@ -206,7 +206,7 @@ public class CallerInfoAsyncQuery { // from within this code. // However, if there is any code that calls this method, we should // check the parameters to make sure they're viable. - Logger.d(this, "Cookie is null, ignoring onQueryComplete() request."); + Log.d(this, "Cookie is null, ignoring onQueryComplete() request."); return; } @@ -235,13 +235,13 @@ public class CallerInfoAsyncQuery { mCallerInfo = new CallerInfo().markAsVoiceMail(); } else { mCallerInfo = CallerInfo.getCallerInfo(mQueryContext, mQueryUri, cursor); - Logger.d(this, "==> Got mCallerInfo: " + mCallerInfo); + Log.d(this, "==> Got mCallerInfo: " + mCallerInfo); CallerInfo newCallerInfo = CallerInfo.doSecondaryLookupIfNecessary( mQueryContext, cw.number, mCallerInfo); if (newCallerInfo != mCallerInfo) { mCallerInfo = newCallerInfo; - Logger.d(this, "#####async contact look up with numeric username" + Log.d(this, "#####async contact look up with numeric username" + mCallerInfo); } @@ -277,7 +277,7 @@ public class CallerInfoAsyncQuery { } } - Logger.d(this, "constructing CallerInfo object for token: " + token); + Log.d(this, "constructing CallerInfo object for token: " + token); //notify that we can clean up the queue after this. CookieWrapper endMarker = new CookieWrapper(); @@ -287,8 +287,8 @@ public class CallerInfoAsyncQuery { //notify the listener that the query is complete. if (cw.listener != null) { - Logger.d(this, "notifying listener: " + cw.listener.getClass().toString() + - " for token: " + token + mCallerInfo); + Log.d(this, "notifying listener: " + cw.listener.getClass().toString() + + " for token: " + token + mCallerInfo); cw.listener.onQueryComplete(token, cw.cookie, mCallerInfo); } } @@ -310,7 +310,7 @@ public class CallerInfoAsyncQuery { CallerInfoAsyncQuery c = new CallerInfoAsyncQuery(); c.allocate(context, contactRef); - Logger.d(LOG_TAG, "starting query for URI: " + contactRef + " handler: " + c.toString()); + Log.d(LOG_TAG, "starting query for URI: " + contactRef + " handler: " + c.toString()); //create cookieWrapper, start query CookieWrapper cw = new CookieWrapper(); @@ -336,9 +336,9 @@ public class CallerInfoAsyncQuery { */ public static CallerInfoAsyncQuery startQuery(int token, Context context, String number, OnQueryCompleteListener listener, Object cookie) { - Logger.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####"); - Logger.d(LOG_TAG, "- number: " + /* number */"xxxxxxx"); - Logger.d(LOG_TAG, "- cookie: " + cookie); + Log.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####"); + Log.d(LOG_TAG, "- number: " + /* number */"xxxxxxx"); + Log.d(LOG_TAG, "- cookie: " + cookie); // Construct the URI object and query params, and start the query. @@ -348,7 +348,7 @@ public class CallerInfoAsyncQuery { if (PhoneNumberUtils.isUriNumber(number)) { // "number" is really a SIP address. - Logger.d(LOG_TAG, " - Treating number as a SIP address: " + /* number */"xxxxxxx"); + Log.d(LOG_TAG, " - Treating number as a SIP address: " + /* number */"xxxxxxx"); // We look up SIP addresses directly in the Data table: contactRef = Data.CONTENT_URI; @@ -380,11 +380,11 @@ public class CallerInfoAsyncQuery { } if (DBG) { - Logger.d(LOG_TAG, "==> contactRef: " + sanitizeUriToString(contactRef)); - Logger.d(LOG_TAG, "==> selection: " + selection); + Log.d(LOG_TAG, "==> contactRef: " + sanitizeUriToString(contactRef)); + Log.d(LOG_TAG, "==> selection: " + selection); if (selectionArgs != null) { for (int i = 0; i < selectionArgs.length; i++) { - Logger.d(LOG_TAG, "==> selectionArgs[" + i + "]: " + selectionArgs[i]); + Log.d(LOG_TAG, "==> selectionArgs[" + i + "]: " + selectionArgs[i]); } } } @@ -422,7 +422,7 @@ public class CallerInfoAsyncQuery { */ public void addQueryListener(int token, OnQueryCompleteListener listener, Object cookie) { - Logger.d(this, "adding listener to query: " + sanitizeUriToString(mHandler.mQueryUri) + + Log.d(this, "adding listener to query: " + sanitizeUriToString(mHandler.mQueryUri) + " handler: " + mHandler.toString()); //create cookieWrapper, add query request to end of queue. diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java index 845a6e3f9..690b9b7b7 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java +++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java @@ -1,7 +1,6 @@ package com.android.incallui; import android.content.Context; -import android.net.Uri; import android.text.TextUtils; import com.android.services.telephony.common.Call; @@ -54,7 +53,7 @@ public class CallerInfoUtils { return info; } else { // Start the query with the number provided from the call. - Logger.d(TAG, "==> Actually starting CallerInfoAsyncQuery.startQuery()..."); + Log.d(TAG, "==> Actually starting CallerInfoAsyncQuery.startQuery()..."); CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, number, listener, call); } } else { @@ -81,7 +80,7 @@ public class CallerInfoUtils { // displayed/logged after this function returns based on the presentation value. if (ci == null || number == null) return number; - Logger.d(TAG, "modifyForSpecialCnapCases: initially, number=" + Log.d(TAG, "modifyForSpecialCnapCases: initially, number=" + toLogSafePhoneNumber(number) + ", presentation=" + presentation + " ci " + ci); @@ -112,12 +111,12 @@ public class CallerInfoUtils { } else if (cnapSpecialCase == Call.PRESENTATION_UNKNOWN) { number = context.getString(R.string.unknown); } - Logger.d(TAG, "SpecialCnap: number=" + toLogSafePhoneNumber(number) + Log.d(TAG, "SpecialCnap: number=" + toLogSafePhoneNumber(number) + "; presentation now=" + cnapSpecialCase); ci.numberPresentation = cnapSpecialCase; } } - Logger.d(TAG, "modifyForSpecialCnapCases: returning number string=" + Log.d(TAG, "modifyForSpecialCnapCases: returning number string=" + toLogSafePhoneNumber(number)); return number; } @@ -131,16 +130,16 @@ public class CallerInfoUtils { if (n.equals("PRIVATE") || n.equals("P") || n.equals("RES")) { - Logger.d(TAG, "checkCnapSpecialCases, PRIVATE string: " + n); + Log.d(TAG, "checkCnapSpecialCases, PRIVATE string: " + n); return Call.PRESENTATION_RESTRICTED; } else if (n.equals("UNAVAILABLE") || n.equals("UNKNOWN") || n.equals("UNA") || n.equals("U")) { - Logger.d(TAG, "checkCnapSpecialCases, UNKNOWN string: " + n); + Log.d(TAG, "checkCnapSpecialCases, UNKNOWN string: " + n); return Call.PRESENTATION_UNKNOWN; } else { - Logger.d(TAG, "checkCnapSpecialCases, normal str. number: " + n); + Log.d(TAG, "checkCnapSpecialCases, normal str. number: " + n); return CNAP_SPECIAL_CASE_NO; } } diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index c5a4cf551..e62900ea9 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -118,7 +118,7 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis */ @Override public void onImageLoadComplete(int token, Drawable photo, Bitmap photoIcon, Object cookie) { - Logger.d(this, "Image load complete with context: ", mContext); + Log.d(this, "Image load complete with context: ", mContext); // TODO: may be nice to update the image view again once the newer one // is available on contacts database. // TODO (klp): What is this, and why does it need the write_contacts permission? @@ -127,23 +127,23 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis final Call call = (Call) cookie; if (!mInfoMap.containsKey(call.getCallId())) { - Logger.e(this, "Image Load received for empty search entry."); + Log.e(this, "Image Load received for empty search entry."); return; } final SearchEntry entry = mInfoMap.get(call.getCallId()); - Logger.d(this, "setting photo for entry: ", entry); + Log.d(this, "setting photo for entry: ", entry); // TODO (klp): Handle conference calls if (photo != null) { - Logger.v(this, "direct drawable: ", photo); + Log.v(this, "direct drawable: ", photo); entry.info.photo = photo; } else if (photoIcon != null) { - Logger.v(this, "photo icon: ", photoIcon); + Log.v(this, "photo icon: ", photoIcon); entry.info.photo = new BitmapDrawable(mContext.getResources(), photoIcon); } else { - Logger.v(this, "unknown photo"); + Log.v(this, "unknown photo"); entry.info.photo = null; } @@ -220,19 +220,19 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis // No name *or* number! Display a generic "unknown" string // (or potentially some other default based on the presentation.) displayName = getPresentationString(presentation); - Logger.d(this, " ==> no name *or* number! displayName = " + displayName); + Log.d(this, " ==> no name *or* number! displayName = " + displayName); } else if (presentation != Call.PRESENTATION_ALLOWED) { // This case should never happen since the network should never send a phone # // AND a restricted presentation. However we leave it here in case of weird // network behavior displayName = getPresentationString(presentation); - Logger.d(this, " ==> presentation not allowed! displayName = " + displayName); + Log.d(this, " ==> presentation not allowed! displayName = " + displayName); } else if (!TextUtils.isEmpty(info.cnapName)) { // No name, but we do have a valid CNAP name, so use that. displayName = info.cnapName; info.name = info.cnapName; displayNumber = number; - Logger.d(this, " ==> cnapName available: displayName '" + Log.d(this, " ==> cnapName available: displayName '" + displayName + "', displayNumber '" + displayNumber + "'"); } else { // No name; all we have is a number. This is the typical @@ -250,10 +250,10 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis // query to only do the geoDescription lookup in the first // place for incoming calls. displayNumber = info.geoDescription; // may be null - Logger.d(this, "Geodescrption: " + info.geoDescription); + Log.d(this, "Geodescrption: " + info.geoDescription); } - Logger.d(this, " ==> no name; falling back to number: displayName '" + Log.d(this, " ==> no name; falling back to number: displayName '" + displayName + "', displayNumber '" + displayNumber + "'"); } } else { @@ -264,18 +264,18 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis // AND a restricted presentation. However we leave it here in case of weird // network behavior displayName = getPresentationString(presentation); - Logger.d(this, " ==> valid name, but presentation not allowed!" + Log.d(this, " ==> valid name, but presentation not allowed!" + " displayName = " + displayName); } else { displayName = info.name; displayNumber = number; label = info.phoneLabel; - Logger.d(this, " ==> name is present in CallerInfo: displayName '" + Log.d(this, " ==> name is present in CallerInfo: displayName '" + displayName + "', displayNumber '" + displayNumber + "'"); } } personUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, info.person_id); - Logger.d(this, "- got personUri: '" + personUri + Log.d(this, "- got personUri: '" + personUri + "', based on info.person_id: " + info.person_id); } else { displayName = getPresentationString(presentation); @@ -292,10 +292,10 @@ public class ContactInfoCache implements CallerInfoAsyncQuery.OnQueryCompleteLis } } else { if (personUri == null) { - Logger.v(this, "personUri is null. Just use unknown picture."); + Log.v(this, "personUri is null. Just use unknown picture."); photo = mContext.getResources().getDrawable(R.drawable.picture_unknown); } else { - Logger.d(this, "startObtainPhotoAsync"); + Log.d(this, "startObtainPhotoAsync"); // Load the image with a callback to update the image state. // When the load is finished, onImageLoadComplete() will be called. ContactsAsyncHelper.startObtainPhotoAsync(TOKEN_UPDATE_PHOTO_FOR_CALL_STATE, diff --git a/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java b/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java index 305486fd1..395fbfdde 100644 --- a/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java +++ b/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java @@ -28,7 +28,6 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.provider.ContactsContract.Contacts; -import android.util.Log; import java.io.IOException; import java.io.InputStream; @@ -68,7 +67,7 @@ public class ContactsAsyncHelper { switch (msg.arg1) { case EVENT_LOAD_IMAGE: if (args.listener != null) { - Logger.d(this, "Notifying listener: " + args.listener.toString() + + Log.d(this, "Notifying listener: " + args.listener.toString() + " image: " + args.uri + " completed"); args.listener.onImageLoadComplete(msg.what, args.photo, args.photoIcon, args.cookie); @@ -192,7 +191,7 @@ public class ContactsAsyncHelper { inputStream = Contacts.openContactPhotoInputStream( args.context.getContentResolver(), args.uri, true); } catch (Exception e) { - Logger.e(this, "Error opening photo input stream", e); + Log.e(this, "Error opening photo input stream", e); } if (inputStream != null) { @@ -203,12 +202,12 @@ public class ContactsAsyncHelper { // BitmapDrawable and thus we can have (down)scaled version of it. args.photoIcon = getPhotoIconWhenAppropriate(args.context, args.photo); - Logger.d(ContactsAsyncHelper.this, "Loading image: " + msg.arg1 + + Log.d(ContactsAsyncHelper.this, "Loading image: " + msg.arg1 + " token: " + msg.what + " image URI: " + args.uri); } else { args.photo = null; args.photoIcon = null; - Logger.d(ContactsAsyncHelper.this, "Problem with image: " + msg.arg1 + + Log.d(ContactsAsyncHelper.this, "Problem with image: " + msg.arg1 + " token: " + msg.what + " image URI: " + args.uri + ", using default image."); } @@ -217,7 +216,7 @@ public class ContactsAsyncHelper { try { inputStream.close(); } catch (IOException e) { - Logger.e(this, "Unable to close input stream.", e); + Log.e(this, "Unable to close input stream.", e); } } } @@ -255,7 +254,7 @@ public class ContactsAsyncHelper { // If the longer edge is much longer than the shorter edge, the latter may // become 0 which will cause a crash. if (newWidth <= 0 || newHeight <= 0) { - Logger.w(this, "Photo icon's width or height become 0."); + Log.w(this, "Photo icon's width or height become 0."); return null; } @@ -298,7 +297,7 @@ public class ContactsAsyncHelper { // in case the source caller info is null, the URI will be null as well. // just update using the placeholder image in this case. if (personUri == null) { - Logger.wtf("startObjectPhotoAsync", "Uri is missing"); + Log.wtf("startObjectPhotoAsync", "Uri is missing"); return; } @@ -317,7 +316,7 @@ public class ContactsAsyncHelper { msg.arg1 = EVENT_LOAD_IMAGE; msg.obj = args; - Logger.d("startObjectPhotoAsync", "Begin loading image: " + args.uri + + Log.d("startObjectPhotoAsync", "Begin loading image: " + args.uri + ", displaying default image for now."); // notify the thread to begin working diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java index b996e4f15..428750dbf 100644 --- a/InCallUI/src/com/android/incallui/DialpadFragment.java +++ b/InCallUI/src/com/android/incallui/DialpadFragment.java @@ -60,7 +60,7 @@ public class DialpadFragment extends BaseFragment */ // TODO(klp) Add timedShortTone==true handling for accessibility cases. public final void processDtmf(char c, boolean timedShortTone) { - Logger.d(this, "Processing dtmf key " + c); + Log.d(this, "Processing dtmf key " + c); // if it is a valid key, then update the display and send the dtmf tone. if (PhoneNumberUtils.is12Key(c)) { - Logger.d(this, "updating display and sending dtmf tone for '" + c + "'"); + Log.d(this, "updating display and sending dtmf tone for '" + c + "'"); // Append this key to the "digits" widget. getUi().appendDigitsToField(c); // Plays the tone through CallCommandService CallCommandClient.getInstance().playDtmfTone(c, timedShortTone); } else { - Logger.d(this, "ignoring dtmf request for '" + c + "'"); + Log.d(this, "ignoring dtmf request for '" + c + "'"); } } @@ -70,7 +70,7 @@ public class DialpadPresenter extends Presenter * Stops the local tone based on the phone type. */ public void stopTone() { - Logger.d(this, "stopping remote tone"); + Log.d(this, "stopping remote tone"); CallCommandClient.getInstance().stopDtmfTone(); } diff --git a/InCallUI/src/com/android/incallui/GlowPadWrapper.java b/InCallUI/src/com/android/incallui/GlowPadWrapper.java index fbc85ef5d..0e1d47d70 100644 --- a/InCallUI/src/com/android/incallui/GlowPadWrapper.java +++ b/InCallUI/src/com/android/incallui/GlowPadWrapper.java @@ -59,7 +59,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger @Override protected void onFinishInflate() { - Logger.d(this, "onFinishInflate()"); + Log.d(this, "onFinishInflate()"); super.onFinishInflate(); setOnTriggerListener(this); startPing(); @@ -67,7 +67,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger @Override protected void onWindowVisibilityChanged(int visibility) { - Logger.d(this, "Visibility changed " + visibility); + Log.d(this, "Visibility changed " + visibility); super.onWindowVisibilityChanged(visibility); switch (visibility) { case View.VISIBLE: @@ -82,7 +82,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger @Override protected Parcelable onSaveInstanceState() { - Logger.d(this, "onSaveInstanceState()"); + Log.d(this, "onSaveInstanceState()"); // TODO: evaluate this versus stopping during fragment onPause/onResume stopPing(); return super.onSaveInstanceState(); @@ -109,19 +109,19 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger @Override public void onGrabbed(View v, int handle) { - Logger.d(this, "onGrabbed()"); + Log.d(this, "onGrabbed()"); stopPing(); } @Override public void onReleased(View v, int handle) { - Logger.d(this, "onReleased()"); + Log.d(this, "onReleased()"); startPing(); } @Override public void onTrigger(View v, int target) { - Logger.d(this, "onTrigger()"); + Log.d(this, "onTrigger()"); final int resId = getResourceIdForTarget(target); switch (resId) { case R.drawable.ic_lockscreen_answer: @@ -135,7 +135,7 @@ public class GlowPadWrapper extends GlowPadView implements GlowPadView.OnTrigger break; default: // Code should never reach here. - Logger.e(this, "Trigger detected on unhandled resource. Skipping."); + Log.e(this, "Trigger detected on unhandled resource. Skipping."); } } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 776f7e013..ec5002f73 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -17,7 +17,6 @@ package com.android.incallui; import android.app.Activity; -import android.app.Fragment; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; @@ -39,7 +38,7 @@ public class InCallActivity extends Activity { @Override protected void onCreate(Bundle icicle) { - Logger.d(this, "onCreate()... this = " + this); + Log.d(this, "onCreate()... this = " + this); super.onCreate(icicle); @@ -60,12 +59,12 @@ public class InCallActivity extends Activity { initializeInCall(); - Logger.d(this, "onCreate(): exit"); + Log.d(this, "onCreate(): exit"); } @Override protected void onResume() { - Logger.d(this, "onResume()..."); + Log.d(this, "onResume()..."); super.onResume(); mIsForegroundActivity = true; @@ -76,7 +75,7 @@ public class InCallActivity extends Activity { // in the background. @Override protected void onPause() { - Logger.d(this, "onPause()..."); + Log.d(this, "onPause()..."); super.onPause(); mIsForegroundActivity = false; @@ -85,13 +84,13 @@ public class InCallActivity extends Activity { @Override protected void onStop() { - Logger.d(this, "onStop()..."); + Log.d(this, "onStop()..."); super.onStop(); } @Override protected void onDestroy() { - Logger.d(this, "onDestroy()... this = " + this); + Log.d(this, "onDestroy()... this = " + this); tearDownPresenters(); @@ -122,13 +121,13 @@ public class InCallActivity extends Activity { */ @Override public void finish() { - Logger.d(this, "finish()..."); + Log.d(this, "finish()..."); super.finish(); } @Override protected void onNewIntent(Intent intent) { - Logger.d(this, "onNewIntent: intent = " + intent); + Log.d(this, "onNewIntent: intent = " + intent); // We're being re-launched with a new Intent. Since it's possible for a // single InCallActivity instance to persist indefinitely (even if we @@ -150,7 +149,7 @@ public class InCallActivity extends Activity { @Override public void onBackPressed() { // TODO(klp): implement fully - Logger.d(this, "onBackPressed()..."); + Log.d(this, "onBackPressed()..."); // BACK is also used to exit out of any "special modes" of the // in-call UI: @@ -196,8 +195,8 @@ public class InCallActivity extends Activity { // Various testing/debugging features, enabled ONLY when VERBOSE == true. case KeyEvent.KEYCODE_SLASH: - if (Logger.VERBOSE) { - Logger.v(this, "----------- InCallActivity View dump --------------"); + if (Log.VERBOSE) { + Log.v(this, "----------- InCallActivity View dump --------------"); // Dump starting from the top-level view of the entire activity: Window w = this.getWindow(); View decorView = w.getDecorView(); @@ -307,7 +306,7 @@ public class InCallActivity extends Activity { } private void tearDownPresenters() { - Logger.d(this, "Tearing down presenters."); + Log.d(this, "Tearing down presenters."); InCallPresenter mainPresenter = InCallPresenter.getInstance(); mainPresenter.removeListener(mCallButtonFragment.getPresenter()); diff --git a/InCallUI/src/com/android/incallui/InCallApp.java b/InCallUI/src/com/android/incallui/InCallApp.java index 299baf35d..02f07b846 100644 --- a/InCallUI/src/com/android/incallui/InCallApp.java +++ b/InCallUI/src/com/android/incallui/InCallApp.java @@ -58,7 +58,7 @@ public class InCallApp extends Application { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); - Logger.v(this, "Broadcast from Notification: ", action); + Log.v(this, "Broadcast from Notification: ", action); if (action.equals(ACTION_HANG_UP_ONGOING_CALL)) { // TODO: Commands of this nature should exist in the CallList or a diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 1931c1b53..8df8c168a 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -78,7 +78,7 @@ public class InCallPresenter implements CallList.Listener { mProximitySensor = new ProximitySensor(context, mAudioModeProvider); addListener(mProximitySensor); - Logger.d(this, "Finished InCallPresenter.setUp"); + Log.d(this, "Finished InCallPresenter.setUp"); } /** @@ -90,7 +90,7 @@ public class InCallPresenter implements CallList.Listener { * that performs the aforementioned logic. */ public void tearDown() { - Logger.d(this, "tearDown"); + Log.d(this, "tearDown"); mServiceConnected = false; attemptCleanup(); } @@ -104,13 +104,13 @@ public class InCallPresenter implements CallList.Listener { mInCallActivity = inCallActivity; if (mInCallActivity != null) { - Logger.d(this, "UI Initialized"); + Log.d(this, "UI Initialized"); // Since the UI just came up, imitate an update from the call list // to set the proper UI state. onCallListChange(mCallList); } else { - Logger.d(this, "setActivity(null)"); + Log.d(this, "setActivity(null)"); attemptCleanup(); } } @@ -131,7 +131,7 @@ public class InCallPresenter implements CallList.Listener { // notify listeners of new state for (InCallStateListener listener : mListeners) { - Logger.d(this, "Notify " + listener + " of state " + mInCallState.toString()); + Log.d(this, "Notify " + listener + " of state " + mInCallState.toString()); listener.onStateChange(mInCallState, callList); } } @@ -219,7 +219,7 @@ public class InCallPresenter implements CallList.Listener { * the UI needs to be started or finished depending on the new state and does it. */ private InCallState startOrFinishUi(InCallState newState) { - Logger.d(this, "startOrFinishUi: " + newState.toString()); + Log.d(this, "startOrFinishUi: " + newState.toString()); // TODO(klp): Consider a proper state machine implementation @@ -264,8 +264,8 @@ public class InCallPresenter implements CallList.Listener { // user with a top-level notification. Just show the call UI normally. final boolean showCallUi = (InCallState.OUTGOING == newState); - Logger.v(this, "showCallUi: ", showCallUi); - Logger.v(this, "startStartupSequence: ", startStartupSequence); + Log.v(this, "showCallUi: ", showCallUi); + Log.v(this, "startStartupSequence: ", startStartupSequence); if (showCallUi) { @@ -297,8 +297,9 @@ public class InCallPresenter implements CallList.Listener { */ private void attemptCleanup() { if (mInCallActivity == null && !mServiceConnected) { - Logger.d(this, "Start InCallPresenter.CleanUp"); + Log.d(this, "Start InCallPresenter.CleanUp"); mProximitySensor = null; + mAudioModeProvider = null; removeListener(mStatusBarNotifier); @@ -312,12 +313,12 @@ public class InCallPresenter implements CallList.Listener { mListeners.clear(); - Logger.d(this, "Finished InCallPresenter.CleanUp"); + Log.d(this, "Finished InCallPresenter.CleanUp"); } } private void showInCall() { - Logger.d(this, "Showing in call manually."); + Log.d(this, "Showing in call manually."); mContext.startActivity(getInCallIntent()); } diff --git a/InCallUI/src/com/android/incallui/Log.java b/InCallUI/src/com/android/incallui/Log.java new file mode 100644 index 000000000..029baceeb --- /dev/null +++ b/InCallUI/src/com/android/incallui/Log.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2006 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.incallui; + +/** + * Manages logging for the entire class. + */ +public class Log { + + // Generic tag for all In Call logging + private static final String TAG = "InCall"; + + public static final boolean DEBUG = android.util.Log.isLoggable(TAG, android.util.Log.DEBUG); + public static final boolean VERBOSE = android.util.Log.isLoggable(TAG, + android.util.Log.VERBOSE); + + public static void d(String tag, String msg) { + if (DEBUG) { + android.util.Log.d(TAG, tag + msg); + } + } + + public static void d(Object obj, String msg) { + if (DEBUG) { + android.util.Log.d(TAG, getPrefix(obj) + msg); + } + } + + public static void d(Object obj, String str1, Object str2) { + if (DEBUG) { + android.util.Log.d(TAG, getPrefix(obj) + str1 + str2); + } + } + + public static void v(Object obj, String msg) { + if (VERBOSE) { + android.util.Log.v(TAG, getPrefix(obj) + msg); + } + } + + public static void v(Object obj, String str1, Object str2) { + if (VERBOSE) { + android.util.Log.d(TAG, getPrefix(obj) + str1 + str2); + } + } + + public static void e(String tag, String msg, Exception e) { + android.util.Log.e(TAG, tag + msg, e); + } + + public static void e(String tag, String msg) { + android.util.Log.e(TAG, tag + msg); + } + + public static void e(Object obj, String msg, Exception e) { + android.util.Log.e(TAG, getPrefix(obj) + msg, e); + } + + public static void e(Object obj, String msg) { + android.util.Log.e(TAG, getPrefix(obj) + msg); + } + + public static void i(String tag, String msg) { + android.util.Log.i(TAG, tag + msg); + } + + public static void i(Object obj, String msg) { + android.util.Log.i(TAG, getPrefix(obj) + msg); + } + + public static void w(Object obj, String msg) { + android.util.Log.w(TAG, getPrefix(obj) + msg); + } + + public static void wtf(Object obj, String msg) { + android.util.Log.wtf(TAG, getPrefix(obj) + msg); + } + + private static String getPrefix(Object obj) { + return (obj == null ? "" : (obj.getClass().getSimpleName() + " - ")); + } +} diff --git a/InCallUI/src/com/android/incallui/Logger.java b/InCallUI/src/com/android/incallui/Logger.java deleted file mode 100644 index 10433bee6..000000000 --- a/InCallUI/src/com/android/incallui/Logger.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2006 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.incallui; - -import android.util.Log; - -/** - * Manages logging for the entire class. - */ -/*package*/ class Logger { - - // Generic tag for all In Call logging - private static final String TAG = "InCall"; - - public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - public static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); - - public static void d(String tag, String msg) { - if (DEBUG) { - Log.d(TAG, tag + msg); - } - } - - public static void d(Object obj, String msg) { - if (DEBUG) { - Log.d(TAG, getPrefix(obj) + msg); - } - } - - public static void d(Object obj, String str1, Object str2) { - if (DEBUG) { - Log.d(TAG, getPrefix(obj) + str1 + str2); - } - } - - public static void v(Object obj, String msg) { - if (VERBOSE) { - Log.v(TAG, getPrefix(obj) + msg); - } - } - - public static void v(Object obj, String str1, Object str2) { - if (VERBOSE) { - Log.d(TAG, getPrefix(obj) + str1 + str2); - } - } - - public static void e(String tag, String msg, Exception e) { - Log.e(TAG, tag + msg, e); - } - - public static void e(String tag, String msg) { - Log.e(TAG, tag + msg); - } - - public static void e(Object obj, String msg, Exception e) { - Log.e(TAG, getPrefix(obj) + msg, e); - } - - public static void e(Object obj, String msg) { - Log.e(TAG, getPrefix(obj) + msg); - } - - public static void i(String tag, String msg) { - Log.i(TAG, tag + msg); - } - - public static void i(Object obj, String msg) { - Log.i(TAG, getPrefix(obj) + msg); - } - - public static void w(Object obj, String msg) { - Log.w(TAG, getPrefix(obj) + msg); - } - - public static void wtf(Object obj, String msg) { - Log.wtf(TAG, getPrefix(obj) + msg); - } - - private static String getPrefix(Object obj) { - return (obj == null ? "" : (obj.getClass().getSimpleName() + " - ")); - } -} diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 0c39dc8ad..466c7b214 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -25,7 +25,6 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.text.TextUtils; import com.android.incallui.ContactInfoCache.ContactCacheEntry; @@ -137,7 +136,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, * @see updateInCallNotification() */ private void cancelInCall() { - Logger.d(this, "cancelInCall()..."); + Log.d(this, "cancelInCall()..."); mNotificationManager.cancel(IN_CALL_NOTIFICATION); mIsShowingNotification = false; @@ -158,8 +157,8 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, */ private void updateInCallNotification(final boolean allowFullScreenIntent, final InCallState state, CallList callList) { - Logger.d(this, "updateInCallNotification(allowFullScreenIntent = " - + allowFullScreenIntent + ")..."); + Log.d(this, "updateInCallNotification(allowFullScreenIntent = " + + allowFullScreenIntent + ")..."); if (shouldSuppressNotification(state, callList)) { cancelInCall(); @@ -168,7 +167,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, final Call call = getCallToShow(callList); if (call == null) { - Logger.wtf(this, "No call for the notification!"); + Log.wtf(this, "No call for the notification!"); } // we make a call to the contact info cache to query for supplemental data to what the @@ -238,7 +237,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, * Fire off the notification */ Notification notification = builder.build(); - Logger.d(this, "Notifying IN_CALL_NOTIFICATION: " + notification); + Log.d(this, "Notifying IN_CALL_NOTIFICATION: " + notification); mNotificationManager.notify(IN_CALL_NOTIFICATION, notification); mIsShowingNotification = true; } @@ -266,13 +265,13 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, // A full screen intent means that we have been asked to interrupt an activity, // so we definitely want to show it. if (showFullScreenIntent) { - Logger.d(this, "Forcing full screen intent"); + Log.d(this, "Forcing full screen intent"); retval = true; } // If we aren't showing a notification right now, definitely start showing one. if (!mIsShowingNotification) { - Logger.d(this, "Showing notification for first time."); + Log.d(this, "Showing notification for first time."); retval = true; } @@ -283,7 +282,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, mSavedContentTitle = contentTitle; if (retval) { - Logger.d(this, "Data changed. Showing notification"); + Log.d(this, "Data changed. Showing notification"); } return retval; @@ -363,7 +362,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, } private void addHangupAction(Notification.Builder builder) { - Logger.i(this, "Will show \"hang-up\" action in the ongoing active call Notification"); + Log.i(this, "Will show \"hang-up\" action in the ongoing active call Notification"); // TODO: use better asset. builder.addAction(R.drawable.stat_sys_phone_call_end, @@ -380,7 +379,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, // to the status bar). Setting fullScreenIntent will cause // the InCallScreen to be launched immediately *unless* the // current foreground activity is marked as "immersive". - Logger.d(this, "- Setting fullScreenIntent: " + intent); + Log.d(this, "- Setting fullScreenIntent: " + intent); builder.setFullScreenIntent(intent, true); // Ugly hack alert: @@ -406,7 +405,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, // TODO(klp): reenable this for klp /*if (incomingCall.getState() == Call.State.CALL_WAITING) { - Logger.i(this, "updateInCallNotification: call-waiting! force relaunch..."); + Log.i(this, "updateInCallNotification: call-waiting! force relaunch..."); // Cancel the IN_CALL_NOTIFICATION immediately before // (re)posting it; this seems to force the // NotificationManager to launch the fullScreenIntent. diff --git a/InCallUI/src/com/android/incallui/util/HttpFetcher.java b/InCallUI/src/com/android/incallui/util/HttpFetcher.java index b54bf718f..6548a5a05 100644 --- a/InCallUI/src/com/android/incallui/util/HttpFetcher.java +++ b/InCallUI/src/com/android/incallui/util/HttpFetcher.java @@ -17,8 +17,8 @@ package com.android.incallui.util; import android.os.SystemClock; -import android.util.Log; +import com.android.incallui.Log; import com.google.common.io.Closeables; import java.io.ByteArrayOutputStream; -- cgit v1.2.3