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

Commit 963801b6 authored by Chen Xu's avatar Chen Xu
Browse files

SystemAPI RoleManager.getFinancialSms

1) telephoy calls hidden IRoleManager API getSmsMessagesForFinancialApp.
In order to mainline telephony, we should call stable system API
instead of hidden AIDL API.

2) decouple ISms from IFinancialSmsCallBack. Pass public
FinancialSmsCallback to RoleManager directly instead of going all
the way to ISms -> AppSmsManager

Bug: 138745655
Bug: 140908357
Test: atest android.telephony.cts.SmsManagerTest
Change-Id: Ibb25583cff46ac796c056c905424b9cc72e7a34e
(cherry picked from commit 0dc25b0f)
Merged-in: Ibb25583cff46ac796c056c905424b9cc72e7a34e
parent 65056969
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -20,16 +20,10 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.app.role.IRoleManager;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.provider.Telephony.Sms.Intents;
import android.telephony.IFinancialSmsCallback;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.telephony.SubscriptionManager;
@@ -146,24 +140,6 @@ public class AppSmsManager {
        return token;
    }

    /**
     * Get filtered SMS messages for financial app.
     */
    public void getSmsMessagesForFinancialApp(
            String callingPkg, Bundle params, final IFinancialSmsCallback callback) {
        try {
            IRoleManager roleManager = IRoleManager.Stub.asInterface(
                    ServiceManager.getServiceOrThrow(Context.ROLE_SERVICE));
            roleManager.getSmsMessagesForFinancialApp(callingPkg, params, callback);
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "Receive RemoteException.");
            // do nothing
        } catch (ServiceNotFoundException e) {
            Log.e(LOG_TAG, "Service not found.");
            // do nothing
        }
    }

    /**
     * Handle an incoming SMS_DELIVER_ACTION intent if it is an app-only SMS.
     */
+0 −9
Original line number Diff line number Diff line
@@ -28,10 +28,8 @@ import android.app.PendingIntent;
import android.content.Context;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.ServiceManager;
import android.provider.Telephony.Sms.Intents;
import android.telephony.IFinancialSmsCallback;
import android.telephony.Rlog;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
@@ -512,13 +510,6 @@ public class SmsController extends ISmsImplBase {
        return getPhone(subId).getAppSmsManager().createAppSpecificSmsToken(callingPkg, intent);
    }

    @Override
    public void getSmsMessagesForFinancialApp(
            int subId, String callingPkg, Bundle params, IFinancialSmsCallback callback) {
        getPhone(subId).getAppSmsManager().getSmsMessagesForFinancialApp(
                callingPkg, params, callback);
    }

    @Override
    public int checkSmsShortCodeDestination(
            int subId, String callingPackage, String destAddress, String countryIso) {