Merge "remove API RoleManager.getFinancialSms"
am: c0fa362e1b
Change-Id: I435dd9621f0a36536403c27a24c8072f7c9936f0
This commit is contained in:
@@ -19,7 +19,6 @@ package android.app.role;
|
||||
import android.app.role.IOnRoleHoldersChangedListener;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteCallback;
|
||||
import android.telephony.IFinancialSmsCallback;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -55,9 +54,4 @@ interface IRoleManager {
|
||||
List<String> getHeldRolesFromController(in String packageName);
|
||||
|
||||
String getDefaultSmsPackage(int userId);
|
||||
|
||||
/**
|
||||
* Get filtered SMS messages for financial app.
|
||||
*/
|
||||
void getSmsMessagesForFinancialApp(in String callingPkg, in Bundle params, in IFinancialSmsCallback callback);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import android.os.ShellCallback;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManagerInternal;
|
||||
import android.service.sms.FinancialSmsService;
|
||||
import android.telephony.IFinancialSmsCallback;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
@@ -675,40 +674,6 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
|
||||
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) {
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
** 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);
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import android.content.pm.PackageManager;
|
||||
import android.database.CursorWindow;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.BaseBundle;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
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 {
|
||||
/**
|
||||
* 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 executor the executor on which callback will be invoked.
|
||||
* @param callback a callback to receive CursorWindow with SMS messages.
|
||||
*
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS)
|
||||
public void getSmsMessagesForFinancialApp(
|
||||
Bundle params,
|
||||
@NonNull @CallbackExecutor Executor executor,
|
||||
@NonNull FinancialSmsCallback callback) {
|
||||
try {
|
||||
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();
|
||||
}
|
||||
// This API is not functional and thus removed to avoid future confusion.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.internal.telephony;
|
||||
import android.app.PendingIntent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.IFinancialSmsCallback;
|
||||
import com.android.internal.telephony.SmsRawData;
|
||||
|
||||
/**
|
||||
@@ -569,17 +568,6 @@ interface ISms {
|
||||
String createAppSpecificSmsTokenWithPackageInfo(
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.internal.telephony;
|
||||
import android.app.PendingIntent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.IFinancialSmsCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -197,12 +196,6 @@ public class ISmsImplBase extends ISms.Stub {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSmsMessagesForFinancialApp(
|
||||
int subId, String callingPkg, Bundle params, IFinancialSmsCallback callback) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkSmsShortCodeDestination(
|
||||
int subid, String callingApk, String destAddress, String countryIso) {
|
||||
|
||||
Reference in New Issue
Block a user