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

Commit 679980cb authored by Chen Xu's avatar Chen Xu Committed by android-build-merger
Browse files

Merge "remove API RoleManager.getFinancialSms"

am: c0fa362e

Change-Id: I435dd9621f0a36536403c27a24c8072f7c9936f0
parents bcec691f c0fa362e
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package android.app.role;
import android.app.role.IOnRoleHoldersChangedListener;
import android.app.role.IOnRoleHoldersChangedListener;
import android.os.Bundle;
import android.os.Bundle;
import android.os.RemoteCallback;
import android.os.RemoteCallback;
import android.telephony.IFinancialSmsCallback;


/**
/**
 * @hide
 * @hide
@@ -55,9 +54,4 @@ interface IRoleManager {
    List<String> getHeldRolesFromController(in String packageName);
    List<String> getHeldRolesFromController(in String packageName);


    String getDefaultSmsPackage(int userId);
    String getDefaultSmsPackage(int userId);

    /**
     * Get filtered SMS messages for financial app.
     */
    void getSmsMessagesForFinancialApp(in String callingPkg, in Bundle params, in IFinancialSmsCallback callback);
}
}
+0 −35
Original line number Original line Diff line number Diff line
@@ -50,7 +50,6 @@ import android.os.ShellCallback;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManagerInternal;
import android.os.UserManagerInternal;
import android.service.sms.FinancialSmsService;
import android.service.sms.FinancialSmsService;
import android.telephony.IFinancialSmsCallback;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.ArraySet;
@@ -675,40 +674,6 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
            dumpOutputStream.flush();
            dumpOutputStream.flush();
        }
        }


        /**
         * Get filtered SMS messages for financial app.
         */
        @Override
        public void getSmsMessagesForFinancialApp(
                String callingPkg, Bundle params, IFinancialSmsCallback callback) {
            int mode = PermissionChecker.checkCallingOrSelfPermissionForDataDelivery(
                    getContext(),
                    AppOpsManager.OPSTR_SMS_FINANCIAL_TRANSACTIONS);

            if (mode == PermissionChecker.PERMISSION_GRANTED) {
                FinancialSmsManager financialSmsManager = new FinancialSmsManager(getContext());
                financialSmsManager.getSmsMessages(new RemoteCallback((result) -> {
                    CursorWindow messages = null;
                    if (result == null) {
                        Slog.w(LOG_TAG, "result is null.");
                    } else {
                        messages = result.getParcelable(FinancialSmsService.EXTRA_SMS_MSGS);
                    }
                    try {
                        callback.onGetSmsMessagesForFinancialApp(messages);
                    } catch (RemoteException e) {
                        // do nothing
                    }
                }), params);
            } else {
                try {
                    callback.onGetSmsMessagesForFinancialApp(null);
                } catch (RemoteException e) {
                    // do nothing
                }
            }
        }

        private int getUidForPackage(String packageName) {
        private int getUidForPackage(String packageName) {
            long ident = Binder.clearCallingIdentity();
            long ident = Binder.clearCallingIdentity();
            try {
            try {
+0 −34
Original line number Original line Diff line number Diff line
/*
** Copyright 2019, 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.telephony;

import android.app.PendingIntent;
import android.database.CursorWindow;
import android.net.Uri;
import android.os.Bundle;
import com.android.internal.telephony.SmsRawData;

/** Interface for returning back the financial sms messages asynchrously.
 *  @hide
 */
interface IFinancialSmsCallback {
    /**
     * Return sms messages back to calling financial app.
     *
     * @param messages the sms messages returned for cinancial app.
     */
    oneway void onGetSmsMessagesForFinancialApp(in CursorWindow messages);
}
+6 −13
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.pm.PackageManager;
import android.database.CursorWindow;
import android.database.CursorWindow;
import android.net.Uri;
import android.net.Uri;
import android.os.Binder;
import android.os.Binder;
import android.os.BaseBundle;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.RemoteException;
@@ -2452,7 +2453,9 @@ public final class SmsManager {
        }
        }
    }
    }


    /** callback for providing asynchronous sms messages for financial app. */
    /**
     * callback for providing asynchronous sms messages for financial app.
     */
    public abstract static class FinancialSmsCallback {
    public abstract static class FinancialSmsCallback {
        /**
        /**
         * Callback to send sms messages back to financial app asynchronously.
         * Callback to send sms messages back to financial app asynchronously.
@@ -2478,24 +2481,14 @@ public final class SmsManager {
     * @param params the parameters to filter SMS messages returned.
     * @param params the parameters to filter SMS messages returned.
     * @param executor the executor on which callback will be invoked.
     * @param executor the executor on which callback will be invoked.
     * @param callback a callback to receive CursorWindow with SMS messages.
     * @param callback a callback to receive CursorWindow with SMS messages.
     *
     */
     */
    @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS)
    @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS)
    public void getSmsMessagesForFinancialApp(
    public void getSmsMessagesForFinancialApp(
            Bundle params,
            Bundle params,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull @CallbackExecutor Executor executor,
            @NonNull FinancialSmsCallback callback) {
            @NonNull FinancialSmsCallback callback) {
        try {
        // This API is not functional and thus removed to avoid future confusion.
            ISms iccSms = getISmsServiceOrThrow();
            iccSms.getSmsMessagesForFinancialApp(
                    getSubscriptionId(), ActivityThread.currentPackageName(), params,
                    new IFinancialSmsCallback.Stub() {
                        public void onGetSmsMessagesForFinancialApp(CursorWindow msgs) {
                            Binder.withCleanCallingIdentity(() -> executor.execute(
                                    () -> callback.onFinancialSmsMessages(msgs)));
                        }});
        } catch (RemoteException ex) {
            ex.rethrowFromSystemServer();
        }
    }
    }


    /**
    /**
+0 −12
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.internal.telephony;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.net.Uri;
import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.telephony.IFinancialSmsCallback;
import com.android.internal.telephony.SmsRawData;
import com.android.internal.telephony.SmsRawData;


/**
/**
@@ -569,17 +568,6 @@ interface ISms {
    String createAppSpecificSmsTokenWithPackageInfo(
    String createAppSpecificSmsTokenWithPackageInfo(
            int subId, String callingPkg, String prefixes, in PendingIntent intent);
            int subId, String callingPkg, String prefixes, in PendingIntent intent);


    /**
     * Get sms inbox messages for the calling financial app.
     *
     * @param subId the SIM id.
     * @param callingPkg the package name of the calling app.
     * @param params parameters to filter the sms messages.
     * @param callback the callback interface to deliver the result.
     */
    void getSmsMessagesForFinancialApp(
        int subId, String callingPkg, in Bundle params, in IFinancialSmsCallback callback);

    /**
    /**
     * Check if the destination is a possible premium short code.
     * Check if the destination is a possible premium short code.
     *
     *
Loading