From 62e995c9bebc02c1a33ffb8d8df142b9a31cab1b Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 28 Mar 2014 10:02:56 -0700 Subject: Remove obsolete/dead code * Remove obsolete/commented code for handling hardware search buttons * Simplify the logic to bring up the incall-screen directly if the user hits the hardware call button while in a call. Change-Id: I003c87c89017c1daa2e6fd68e0771aeefa19c846 --- src/com/android/dialer/DialtactsActivity.java | 65 +++++---------------------- 1 file changed, 12 insertions(+), 53 deletions(-) (limited to 'src/com') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index b8faaaf64..cc45a988e 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -294,9 +294,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O super.onCreate(savedInstanceState); mFirstLaunch = true; - final Intent intent = getIntent(); - fixIntent(intent); - setContentView(R.layout.dialtacts_activity); getWindow().setBackgroundDrawable(null); @@ -700,38 +697,25 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O return menu; } - private void fixIntent(Intent intent) { - // This should be cleaned up: the call key used to send an Intent - // that just said to go to the recent calls list. It now sends this - // abstract action, but this class hasn't been rewritten to deal with it. - if (Intent.ACTION_CALL_BUTTON.equals(intent.getAction())) { - intent.setDataAndType(Calls.CONTENT_URI, Calls.CONTENT_TYPE); - intent.putExtra("call_key", true); - setIntent(intent); - } - } - /** * Returns true if the intent is due to hitting the green send key (hardware call button: * KEYCODE_CALL) while in a call. * * @param intent the intent that launched this activity - * @param recentCallsRequest true if the intent is requesting to view recent calls * @return true if the intent is due to hitting the green send key while in a call */ - private boolean isSendKeyWhileInCall(Intent intent, boolean recentCallsRequest) { - // If there is a call in progress go to the call screen - if (recentCallsRequest) { - final boolean callKey = intent.getBooleanExtra("call_key", false); - - try { - ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); - if (callKey && phone != null && phone.showCallScreen()) { - return true; - } - } catch (RemoteException e) { - Log.e(TAG, "Failed to handle send while in call", e); + private boolean isSendKeyWhileInCall(Intent intent) { + // If there is a call in progress and the user launched the dialer by hitting the call + // button, go straight to the in-call screen. + final boolean callKey = Intent.ACTION_CALL_BUTTON.equals(intent.getAction()); + + try { + ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); + if (callKey && phone != null && phone.showCallScreen()) { + return true; } + } catch (RemoteException e) { + Log.e(TAG, "Failed to handle send while in call", e); } return false; @@ -744,9 +728,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O */ private void displayFragment(Intent intent) { // If we got here by hitting send and we're in call forward along to the in-call activity - boolean recentCallsRequest = Calls.CONTENT_TYPE.equals(intent.resolveType( - getContentResolver())); - if (isSendKeyWhileInCall(intent, recentCallsRequest)) { + if (isSendKeyWhileInCall(intent)) { finish(); return; } @@ -766,7 +748,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onNewIntent(Intent newIntent) { setIntent(newIntent); - fixIntent(newIntent); displayFragment(newIntent); final String action = newIntent.getAction(); @@ -813,28 +794,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } }; - /* TODO krelease: This is only relevant for phones that have a hard button search key (i.e. - * Nexus S). Supporting it is a little more tricky because of the dialpad fragment might - * be showing when the search key is pressed so there is more state management involved. - - @Override - public void startSearch(String initialQuery, boolean selectInitialQuery, - Bundle appSearchData, boolean globalSearch) { - if (mRegularSearchFragment != null && mRegularSearchFragment.isAdded() && !globalSearch) { - if (mInSearchUi) { - if (mSearchView.hasFocus()) { - showInputMethod(mSearchView.findFocus()); - } else { - mSearchView.requestFocus(); - } - } else { - enterSearchUi(); - } - } else { - super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch); - } - }*/ - private void showInputMethod(View view) { final InputMethodManager imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); -- cgit v1.2.3