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

Commit df7e481b authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Add API surface for "keep SMS app running".

Bug: 109809543
Test: build & boot
Change-Id: Ie9ebf1f34052394a92c3f260413c18596709d3a3
parent d4cf67e2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ java_defaults {
        "core/java/android/app/ISearchManager.aidl",
        "core/java/android/app/ISearchManagerCallback.aidl",
        "core/java/android/app/IServiceConnection.aidl",
        "core/java/android/app/ISmsAppService.aidl",
        "core/java/android/app/IStopUserCallback.aidl",
        "core/java/android/app/job/IJobCallback.aidl",
        "core/java/android/app/job/IJobScheduler.aidl",
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ package android {
    field public static final java.lang.String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
    field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
    field public static final java.lang.String BIND_SCREENING_SERVICE = "android.permission.BIND_SCREENING_SERVICE";
    field public static final java.lang.String BIND_SMS_APP_SERVICE = "android.permission.BIND_SMS_APP_SERVICE";
    field public static final java.lang.String BIND_TELECOM_CONNECTION_SERVICE = "android.permission.BIND_TELECOM_CONNECTION_SERVICE";
    field public static final java.lang.String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE";
    field public static final java.lang.String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT";
@@ -6095,6 +6096,11 @@ package android.app {
    method public abstract void onSharedElementsReady();
  }
  public class SmsAppService extends android.app.Service {
    ctor public SmsAppService();
    method public final android.os.IBinder onBind(android.content.Intent);
  }
  public deprecated class TabActivity extends android.app.ActivityGroup {
    ctor public TabActivity();
    method public android.widget.TabHost getTabHost();
@@ -43058,6 +43064,7 @@ package android.telephony {
    field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
    field public static final java.lang.String ACTION_SECRET_CODE = "android.telephony.action.SECRET_CODE";
    field public static final java.lang.String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION";
    field public static final java.lang.String ACTION_SMS_APP_SERVICE = "android.telephony.action.SMS_APP_SERVICE";
    field public static final java.lang.String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED";
    field public static final int APPTYPE_CSIM = 4; // 0x4
    field public static final int APPTYPE_ISIM = 5; // 0x5
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.app;

/**
 * @hide
 */
interface ISmsAppService {
}
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.app;

import android.content.ComponentName;
import android.content.Intent;
import android.os.IBinder;

/**
 * If the default SMS app has a service that extends this class, the system always tries to bind
 * it so that the process is always running, which allows the app to have a persistent connection
 * to the server.
 *
 * <p>The service must have {@link android.telephony.TelephonyManager#ACTION_SMS_APP_SERVICE}
 * action in the intent handler, and be protected with
 * {@link android.Manifest.permission#BIND_SMS_APP_SERVICE}. However the service does not have to
 * be exported.
 *
 * <p>Apps can use
 * {@link android.content.pm.PackageManager#setComponentEnabledSetting(ComponentName, int, int)}
 * to disable/enable the service. Apps should use it to disable the service when it no longer needs
 * to be running.
 *
 * <p>When the owner process crashes, the service will be re-bound automatically after a
 * back-off.
 *
 * <p>Note the process may still be killed if the system is under heavy memory pressure, in which
 * case the process will be re-started later.
 */
public class SmsAppService extends Service {
    private final ISmsAppService mImpl;

    public SmsAppService() {
        mImpl = new ISmsAppServiceImpl();
    }

    @Override
    public final IBinder onBind(Intent intent) {
        return mImpl.asBinder();
    }

    private class ISmsAppServiceImpl extends ISmsAppService.Stub {
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -4301,6 +4301,12 @@ public abstract class Context {
     */
    public static final String TIME_ZONE_DETECTOR_SERVICE = "time_zone_detector";

    /**
     * Binder service name for {@link AppBindingService}.
     * @hide
     */
    public static final String APP_BINDING_SERVICE = "app_binding";

    /**
     * Determine whether the given permission is allowed for a particular
     * process and user ID running in the system.
Loading