summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt13
-rw-r--r--core/java/android/app/ContextImpl.java8
-rw-r--r--core/java/android/content/Context.java15
-rw-r--r--phone/java/android/phone/PhoneManager.java68
-rw-r--r--telecomm/java/android/telecomm/TelecommManager.java2
5 files changed, 100 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt
index 8548e2f..5f8dd9a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -7099,13 +7099,13 @@ package android.content {
field public static final java.lang.String NFC_SERVICE = "nfc";
field public static final java.lang.String NOTIFICATION_SERVICE = "notification";
field public static final java.lang.String NSD_SERVICE = "servicediscovery";
+ field public static final java.lang.String PHONE_SERVICE = "phone_service";
field public static final java.lang.String POWER_SERVICE = "power";
field public static final java.lang.String PRINT_SERVICE = "print";
field public static final java.lang.String RESTRICTIONS_SERVICE = "restrictions";
field public static final java.lang.String SEARCH_SERVICE = "search";
field public static final java.lang.String SENSOR_SERVICE = "sensor";
field public static final java.lang.String STORAGE_SERVICE = "storage";
- field public static final java.lang.String TELECOMM_SERVICE = "telecomm";
field public static final java.lang.String TELEPHONY_SERVICE = "phone";
field public static final java.lang.String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
field public static final java.lang.String TV_INPUT_SERVICE = "tv_input";
@@ -21768,6 +21768,14 @@ package android.os.storage {
}
+package android.phone {
+
+ public final class PhoneManager {
+ method public boolean handlePinMmi(java.lang.String);
+ }
+
+}
+
package android.preference {
public class CheckBoxPreference extends android.preference.TwoStatePreference {
@@ -27850,9 +27858,6 @@ package android.telecomm {
field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.intent.extra.START_CALL_WITH_SPEAKERPHONE";
}
- public class TelecommManager {
- }
-
public class VideoCallProfile implements android.os.Parcelable {
ctor public VideoCallProfile(int, int);
method public int describeContents();
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 425a140..fa2266b 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -113,6 +113,7 @@ import android.os.SystemVibrator;
import android.os.UserManager;
import android.os.storage.IMountService;
import android.os.storage.StorageManager;
+import android.phone.PhoneManager;
import android.print.IPrintManager;
import android.print.PrintManager;
import android.service.fingerprint.IFingerprintService;
@@ -560,6 +561,13 @@ class ContextImpl extends Context {
ITelecommService.Stub.asInterface(b));
}});
+ registerService(PHONE_SERVICE, new ServiceFetcher() {
+ public Object createService(ContextImpl ctx) {
+ IBinder b = ServiceManager.getService(TELECOMM_SERVICE);
+ return new PhoneManager(ctx.getOuterContext(),
+ ITelecommService.Stub.asInterface(b));
+ }});
+
registerService(UI_MODE_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
return new UiModeManager();
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index fd19b40..80b6b58 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2164,8 +2164,8 @@ public abstract class Context {
* @see android.media.MediaRouter
* @see #TELEPHONY_SERVICE
* @see android.telephony.TelephonyManager
- * @see #TELECOMM_SERVICE
- * @see android.telecomm.TelecommManager
+ * @see #PHONE_SERVICE
+ * @see android.phone.PhoneManager
* @see #INPUT_METHOD_SERVICE
* @see android.view.inputmethod.InputMethodManager
* @see #UI_MODE_SERVICE
@@ -2502,11 +2502,22 @@ public abstract class Context {
*
* @see #getSystemService
* @see android.telecomm.TelecommManager
+ * @hide
*/
public static final String TELECOMM_SERVICE = "telecomm";
/**
* Use with {@link #getSystemService} to retrieve a
+ * {@link android.phone.PhoneManager} to manage phone-related features
+ * of the device.
+ *
+ * @see #getSystemService
+ * @see android.phone.PhoneManager
+ */
+ public static final String PHONE_SERVICE = "phone_service"; // "phone" used by telephony.
+
+ /**
+ * Use with {@link #getSystemService} to retrieve a
* {@link android.text.ClipboardManager} for accessing and modifying
* the contents of the global clipboard.
*
diff --git a/phone/java/android/phone/PhoneManager.java b/phone/java/android/phone/PhoneManager.java
new file mode 100644
index 0000000..cbef347
--- /dev/null
+++ b/phone/java/android/phone/PhoneManager.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2014 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 android.phone;
+
+import android.content.Context;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+
+import com.android.internal.telecomm.ITelecommService;
+import com.android.internal.telephony.ITelephony;
+
+/**
+ * Exposes call-related functionality for use by phone and dialer apps.
+ */
+public final class PhoneManager {
+ private static final String TAG = PhoneManager.class.getSimpleName();
+
+ private final Context mContext;
+ private final ITelecommService mService;
+
+ /**
+ * @hide
+ */
+ public PhoneManager(Context context, ITelecommService service) {
+ Context appContext = context.getApplicationContext();
+ if (appContext != null) {
+ mContext = appContext;
+ } else {
+ mContext = context;
+ }
+
+ mService = service;
+ }
+
+ /**
+ * Processes the specified dial string as an MMI code.
+ *
+ * @param dialString The digits to dial.
+ * @return True if the digits were processed as an MMI code, false otherwise.
+ */
+ public boolean handlePinMmi(String dialString) {
+ try {
+ return getITelephony().handlePinMmi(dialString);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#handlePinMmi", e);
+ }
+ return false;
+ }
+
+ private ITelephony getITelephony() {
+ return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
+ }
+}
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index 6bb75be..1bb18f2 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -25,6 +25,8 @@ import com.android.internal.telecomm.ITelecommService;
/**
* Provides access to Telecomm-related functionality.
+ * TODO(santoscordon): Move this all into PhoneManager.
+ * @hide
*/
public class TelecommManager {
private static final String TAG = "TelecommManager";