Loading AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" /> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> <uses-permission android:name="android.permission.CALL_PRIVILEGED" /> <!-- This tells the activity manager to not delay any of our activity start requests, even if they happen immediately after the user presses home. --> Loading res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,6 @@ <!--not display SIP dial icon --> <bool name="config_hide_SIP_dial_icon">false</bool> <integer name="speed_dial_emergency_number_assigned_key">9</integer> </resources> res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1119,6 +1119,9 @@ ey \'<xliff:g id="number">%s</xliff:g>\'. Do you want to assign an action now?</ <string name="dialog_speed_dial_airplane_mode_message">To use speed dial, first turn off Airplan e mode.</string> <!-- Speed Dial can not be set for the key used for Emergency number--> <string name="speed_dial_can_not_be_set">Speed Dial Can not be set for this Key</string> <string name="yes">Yes</string> <string name="no">No</string> Loading src/com/android/dialer/SpeedDialListActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.SystemProperties; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.Settings; Loading @@ -64,6 +65,7 @@ import android.widget.ListView; import android.widget.PopupMenu; import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.Toast; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; Loading Loading @@ -110,6 +112,9 @@ public class SpeedDialListActivity extends ListActivity implements private static final int MENU_REPLACE = 1001; private static final int MENU_DELETE = 1002; private static final String PROPERTY_RADIO_ATEL_CARRIER = "persist.radio.atel.carrier"; private static final String CARRIER_ONE_DEFAULT_MCC_MNC = "405854"; private static class Record { long contactId; String name; Loading @@ -135,6 +140,9 @@ public class SpeedDialListActivity extends ListActivity implements private SubscriptionManager mSubscriptionManager; private boolean mEmergencyCallSpeedDial = false; private int mSpeedDialKeyforEmergncyCall = -1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Loading @@ -161,6 +169,11 @@ public class SpeedDialListActivity extends ListActivity implements mAdapter = new SpeedDialAdapter(); setListAdapter(mAdapter); String property = SystemProperties.get(PROPERTY_RADIO_ATEL_CARRIER); mEmergencyCallSpeedDial = CARRIER_ONE_DEFAULT_MCC_MNC.equals(property); mSpeedDialKeyforEmergncyCall = getResources().getInteger( R.integer.speed_dial_emergency_number_assigned_key); } @Override Loading Loading @@ -315,6 +328,11 @@ public class SpeedDialListActivity extends ListActivity implements } } else { int number = position + 1; if (mEmergencyCallSpeedDial && (number == mSpeedDialKeyforEmergncyCall)) { Toast.makeText(SpeedDialListActivity.this, R.string.speed_dial_can_not_be_set, Toast.LENGTH_SHORT).show(); return; } final Record record = mRecords.get(number); if (record == null) { showAddSpeedDialDialog(number); Loading src/com/android/dialer/dialpad/DialpadFragment.java +39 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading Loading @@ -192,6 +193,9 @@ public class DialpadFragment extends Fragment /** Stream type used to play the DTMF tones off call, and mapped to the volume control keys */ private static final int DIAL_TONE_STREAM_TYPE = AudioManager.STREAM_DTMF; private static final String PROPERTY_RADIO_ATEL_CARRIER = "persist.radio.atel.carrier"; private static final String CARRIER_ONE_DEFAULT_MCC_MNC = "405854"; private OnDialpadQueryChangedListener mDialpadQueryListener; Loading Loading @@ -1122,6 +1126,33 @@ public class DialpadFragment extends Fragment } } private int getNumberfromId(int id) { int number = -1; switch(id) { case R.id.zero: number = 0; break; case R.id.one: number = 1; break; case R.id.two: number = 2; break; case R.id.three: number = 3; break; case R.id.four: number = 4; break; case R.id.five: number = 5; break; case R.id.six: number = 6; break; case R.id.seven: number = 7; break; case R.id.eight: number = 8; break; case R.id.nine: number = 9; break; } return number; } private void placeEmergencyCall() { Resources resources = getContext().getResources(); String emergencyNumber = resources.getString( com.android.internal.R.string.power_key_emergency_number); Intent intent = new Intent(Intent.ACTION_CALL_EMERGENCY); intent.setData(Uri.fromParts(PhoneAccount.SCHEME_TEL, emergencyNumber, null)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } @Override public boolean onLongClick(View view) { final Editable digits = mDigits.getText(); Loading Loading @@ -1218,6 +1249,14 @@ public class DialpadFragment extends Fragment case R.id.nine: { if (mDigits.length() == 1) { //removePreviousDigitIfPossible(); String property = SystemProperties.get(PROPERTY_RADIO_ATEL_CARRIER); boolean isCarrierOneSupported = CARRIER_ONE_DEFAULT_MCC_MNC.equals(property); if (isCarrierOneSupported && (getNumberfromId(id) == getContext().getResources().getInteger( R.integer.speed_dial_emergency_number_assigned_key))) { placeEmergencyCall(); return true; } final boolean isAirplaneModeOn = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; Loading Loading
AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" /> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> <uses-permission android:name="android.permission.CALL_PRIVILEGED" /> <!-- This tells the activity manager to not delay any of our activity start requests, even if they happen immediately after the user presses home. --> Loading
res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -36,4 +36,6 @@ <!--not display SIP dial icon --> <bool name="config_hide_SIP_dial_icon">false</bool> <integer name="speed_dial_emergency_number_assigned_key">9</integer> </resources>
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1119,6 +1119,9 @@ ey \'<xliff:g id="number">%s</xliff:g>\'. Do you want to assign an action now?</ <string name="dialog_speed_dial_airplane_mode_message">To use speed dial, first turn off Airplan e mode.</string> <!-- Speed Dial can not be set for the key used for Emergency number--> <string name="speed_dial_can_not_be_set">Speed Dial Can not be set for this Key</string> <string name="yes">Yes</string> <string name="no">No</string> Loading
src/com/android/dialer/SpeedDialListActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.SystemProperties; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.Settings; Loading @@ -64,6 +65,7 @@ import android.widget.ListView; import android.widget.PopupMenu; import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.Toast; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; Loading Loading @@ -110,6 +112,9 @@ public class SpeedDialListActivity extends ListActivity implements private static final int MENU_REPLACE = 1001; private static final int MENU_DELETE = 1002; private static final String PROPERTY_RADIO_ATEL_CARRIER = "persist.radio.atel.carrier"; private static final String CARRIER_ONE_DEFAULT_MCC_MNC = "405854"; private static class Record { long contactId; String name; Loading @@ -135,6 +140,9 @@ public class SpeedDialListActivity extends ListActivity implements private SubscriptionManager mSubscriptionManager; private boolean mEmergencyCallSpeedDial = false; private int mSpeedDialKeyforEmergncyCall = -1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Loading @@ -161,6 +169,11 @@ public class SpeedDialListActivity extends ListActivity implements mAdapter = new SpeedDialAdapter(); setListAdapter(mAdapter); String property = SystemProperties.get(PROPERTY_RADIO_ATEL_CARRIER); mEmergencyCallSpeedDial = CARRIER_ONE_DEFAULT_MCC_MNC.equals(property); mSpeedDialKeyforEmergncyCall = getResources().getInteger( R.integer.speed_dial_emergency_number_assigned_key); } @Override Loading Loading @@ -315,6 +328,11 @@ public class SpeedDialListActivity extends ListActivity implements } } else { int number = position + 1; if (mEmergencyCallSpeedDial && (number == mSpeedDialKeyforEmergncyCall)) { Toast.makeText(SpeedDialListActivity.this, R.string.speed_dial_can_not_be_set, Toast.LENGTH_SHORT).show(); return; } final Record record = mRecords.get(number); if (record == null) { showAddSpeedDialDialog(number); Loading
src/com/android/dialer/dialpad/DialpadFragment.java +39 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading Loading @@ -192,6 +193,9 @@ public class DialpadFragment extends Fragment /** Stream type used to play the DTMF tones off call, and mapped to the volume control keys */ private static final int DIAL_TONE_STREAM_TYPE = AudioManager.STREAM_DTMF; private static final String PROPERTY_RADIO_ATEL_CARRIER = "persist.radio.atel.carrier"; private static final String CARRIER_ONE_DEFAULT_MCC_MNC = "405854"; private OnDialpadQueryChangedListener mDialpadQueryListener; Loading Loading @@ -1122,6 +1126,33 @@ public class DialpadFragment extends Fragment } } private int getNumberfromId(int id) { int number = -1; switch(id) { case R.id.zero: number = 0; break; case R.id.one: number = 1; break; case R.id.two: number = 2; break; case R.id.three: number = 3; break; case R.id.four: number = 4; break; case R.id.five: number = 5; break; case R.id.six: number = 6; break; case R.id.seven: number = 7; break; case R.id.eight: number = 8; break; case R.id.nine: number = 9; break; } return number; } private void placeEmergencyCall() { Resources resources = getContext().getResources(); String emergencyNumber = resources.getString( com.android.internal.R.string.power_key_emergency_number); Intent intent = new Intent(Intent.ACTION_CALL_EMERGENCY); intent.setData(Uri.fromParts(PhoneAccount.SCHEME_TEL, emergencyNumber, null)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } @Override public boolean onLongClick(View view) { final Editable digits = mDigits.getText(); Loading Loading @@ -1218,6 +1249,14 @@ public class DialpadFragment extends Fragment case R.id.nine: { if (mDigits.length() == 1) { //removePreviousDigitIfPossible(); String property = SystemProperties.get(PROPERTY_RADIO_ATEL_CARRIER); boolean isCarrierOneSupported = CARRIER_ONE_DEFAULT_MCC_MNC.equals(property); if (isCarrierOneSupported && (getNumberfromId(id) == getContext().getResources().getInteger( R.integer.speed_dial_emergency_number_assigned_key))) { placeEmergencyCall(); return true; } final boolean isAirplaneModeOn = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; Loading