Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4ce1432 authored by Yorke Lee's avatar Yorke Lee
Browse files

Add TelecommManager to system services

Change-Id: I48a75c578a99aca1149fbae84a5d0f9ac0a457f3
parent c4858a2b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7041,6 +7041,7 @@ package android.content {
    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";
@@ -27686,6 +27687,9 @@ package android.telecomm {
    field public static final java.lang.String EXTRA_PACKAGE_NAME = "package";
  }
  public class TelecommManager {
  }
}
package android.telephony {
+9 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ import android.print.PrintManager;
import android.service.fingerprint.FingerprintManager;
import android.service.fingerprint.FingerprintManagerReceiver;
import android.service.fingerprint.FingerprintService;
import android.telecomm.TelecommManager;
import android.telephony.TelephonyManager;
import android.content.ClipboardManager;
import android.util.AndroidRuntimeException;
@@ -142,6 +143,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IAppOpsService;
import com.android.internal.appwidget.IAppWidgetService.Stub;
import com.android.internal.os.IDropBoxManagerService;
import com.android.internal.telecomm.ITelecommService;

import java.io.File;
import java.io.FileInputStream;
@@ -554,6 +556,13 @@ class ContextImpl extends Context {
                    return new TelephonyManager(ctx.getOuterContext());
                }});

        registerService(TELECOMM_SERVICE, new ServiceFetcher() {
                public Object createService(ContextImpl ctx) {
                    IBinder b = ServiceManager.getService(TELECOMM_SERVICE);
                    return new TelecommManager(ctx.getOuterContext(),
                            ITelecommService.Stub.asInterface(b));
                }});

        registerService(UI_MODE_SERVICE, new ServiceFetcher() {
                public Object createService(ContextImpl ctx) {
                    return new UiModeManager();
+13 −0
Original line number Diff line number Diff line
@@ -2035,6 +2035,7 @@ public abstract class Context {
            AUDIO_SERVICE,
            MEDIA_ROUTER_SERVICE,
            TELEPHONY_SERVICE,
            TELECOMM_SERVICE,
            CLIPBOARD_SERVICE,
            INPUT_METHOD_SERVICE,
            TEXT_SERVICES_MANAGER_SERVICE,
@@ -2163,6 +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 #INPUT_METHOD_SERVICE
     * @see android.view.inputmethod.InputMethodManager
     * @see #UI_MODE_SERVICE
@@ -2492,6 +2495,16 @@ public abstract class Context {
     */
    public static final String TELEPHONY_SERVICE = "phone";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.telecomm.TelecommManager} to manage telecomm-related features
     * of the device.
     *
     * @see #getSystemService
     * @see android.telecomm.TelecommManager
     */
    public static final String TELECOMM_SERVICE = "telecomm";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.text.ClipboardManager} for accessing and modifying
+48 −0
Original line number Diff line number Diff line
/*
 * 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.telecomm;

import android.content.Context;

import com.android.internal.telecomm.ITelecommService;

/**
 * Provides access to Telecomm-related functionality.
 */
public class TelecommManager {
    private static final String TAG = "TelecommManager";

    private final Context mContext;
    private final ITelecommService mService;

    /** @hide */
    public TelecommManager(Context context, ITelecommService service) {
        Context appContext = context.getApplicationContext();
        if (appContext != null) {
            mContext = appContext;
        } else {
            mContext = context;
        }

        mService = service;
    }

    /** {@hide} */
    public static TelecommManager from(Context context) {
        return (TelecommManager) context.getSystemService(Context.TELECOMM_SERVICE);
    }
}