Remove finacial app sms access temp implementation due to security
concern.
Test: m -j150 ExtServices && adb install -r ${OUT}/system/priv-app/ExtServices/ExtServices.apk
atest FinancialSmsServiceImplTest
Bug: 111207447
Change-Id: I9f9c7b9b61014daddabbac9d59a471cd8d711d6e
This commit is contained in:
@@ -17,14 +17,10 @@ package android.ext.services.sms;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWindow;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.service.sms.FinancialSmsService;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
/**
|
||||
* Service to provide financial apps access to sms messages.
|
||||
*/
|
||||
@@ -36,45 +32,6 @@ public class FinancialSmsServiceImpl extends FinancialSmsService {
|
||||
@Nullable
|
||||
@Override
|
||||
public CursorWindow onGetSmsMessages(@NonNull Bundle params) {
|
||||
ArrayList<String> columnNames = params.getStringArrayList(KEY_COLUMN_NAMES);
|
||||
if (columnNames == null || columnNames.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Uri inbox = Uri.parse("content://sms/inbox");
|
||||
|
||||
try (Cursor cursor = getContentResolver().query(inbox, null, null, null, null);
|
||||
CursorWindow window = new CursorWindow("FinancialSmsMessages")) {
|
||||
int messageCount = cursor.getCount();
|
||||
if (messageCount > 0 && cursor.moveToFirst()) {
|
||||
window.setNumColumns(columnNames.size());
|
||||
for (int row = 0; row < messageCount; row++) {
|
||||
if (!window.allocRow()) {
|
||||
Log.e(TAG, "CursorWindow ran out of memory.");
|
||||
return null;
|
||||
}
|
||||
for (int col = 0; col < columnNames.size(); col++) {
|
||||
String columnName = columnNames.get(col);
|
||||
int inboxColumnIndex = cursor.getColumnIndexOrThrow(columnName);
|
||||
String inboxColumnValue = cursor.getString(inboxColumnIndex);
|
||||
boolean addedToCursorWindow = window.putString(inboxColumnValue, row, col);
|
||||
if (!addedToCursorWindow) {
|
||||
Log.e(TAG, "Failed to add:"
|
||||
+ inboxColumnValue
|
||||
+ ";column:"
|
||||
+ columnName);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
cursor.moveToNext();
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "No sms messages.");
|
||||
}
|
||||
return window;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to get sms messages.");
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user