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

Commit efbfe8ce authored by Zhihai Xu's avatar Zhihai Xu Committed by Android (Google) Code Review
Browse files

Merge "Bluetooth OPP should sanitize Uri data and MIME types before calling startActivity"

parents 32f98731 8d1558d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -169,7 +169,7 @@ public class BluetoothOppLauncherActivity extends Activity {
            Intent intent1 = new Intent();
            Intent intent1 = new Intent();
            intent1.setAction(action);
            intent1.setAction(action);
            intent1.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent1.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent1.setData(uri);
            intent1.setDataAndNormalize(uri);
            this.sendBroadcast(intent1);
            this.sendBroadcast(intent1);
            finish();
            finish();
        } else {
        } else {
+1 −1
Original line number Original line Diff line number Diff line
@@ -68,7 +68,7 @@ public class BluetoothOppLiveFolder extends Activity {
    private static Intent createLiveFolder(Context context, Uri uri, String name, int icon) {
    private static Intent createLiveFolder(Context context, Uri uri, String name, int icon) {
        final Intent intent = new Intent();
        final Intent intent = new Intent();


        intent.setData(uri);
        intent.setDataAndNormalize(uri);
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT, new Intent(
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT, new Intent(
                Constants.ACTION_OPEN, BluetoothShare.CONTENT_URI));
                Constants.ACTION_OPEN, BluetoothShare.CONTENT_URI));
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
+3 −3
Original line number Original line Diff line number Diff line
@@ -330,7 +330,7 @@ class BluetoothOppNotification {


            Intent intent = new Intent(Constants.ACTION_LIST);
            Intent intent = new Intent(Constants.ACTION_LIST);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));
            intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));


            b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent, 0));
            b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent, 0));
            mNotificationMgr.notify(item.id, b.getNotification());
            mNotificationMgr.notify(item.id, b.getNotification());
@@ -491,7 +491,7 @@ class BluetoothOppNotification {


            Intent intent = new Intent(Constants.ACTION_INCOMING_FILE_CONFIRM);
            Intent intent = new Intent(Constants.ACTION_INCOMING_FILE_CONFIRM);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(contentUri);
            intent.setDataAndNormalize(contentUri);


            n.when = timeStamp;
            n.when = timeStamp;
            n.setLatestEventInfo(mContext, title, caption, PendingIntent.getBroadcast(mContext, 0,
            n.setLatestEventInfo(mContext, title, caption, PendingIntent.getBroadcast(mContext, 0,
@@ -499,7 +499,7 @@ class BluetoothOppNotification {


            intent = new Intent(Constants.ACTION_HIDE);
            intent = new Intent(Constants.ACTION_HIDE);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(contentUri);
            intent.setDataAndNormalize(contentUri);
            n.deleteIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
            n.deleteIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);


            mNotificationMgr.notify(id, n);
            mNotificationMgr.notify(id, n);
+2 −2
Original line number Original line Diff line number Diff line
@@ -116,7 +116,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            Uri uri = intent.getData();
            Uri uri = intent.getData();
            Intent in = new Intent(context, BluetoothOppIncomingFileConfirmActivity.class);
            Intent in = new Intent(context, BluetoothOppIncomingFileConfirmActivity.class);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setData(uri);
            in.setDataAndNormalize(uri);
            context.startActivity(in);
            context.startActivity(in);


            NotificationManager notMgr = (NotificationManager)context
            NotificationManager notMgr = (NotificationManager)context
@@ -157,7 +157,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            } else {
            } else {
                Intent in = new Intent(context, BluetoothOppTransferActivity.class);
                Intent in = new Intent(context, BluetoothOppTransferActivity.class);
                in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                in.setData(uri);
                in.setDataAndNormalize(uri);
                context.startActivity(in);
                context.startActivity(in);
            }
            }


+1 −1
Original line number Original line Diff line number Diff line
@@ -289,7 +289,7 @@ public class BluetoothOppTransferHistory extends Activity implements
        } else {
        } else {
            Intent in = new Intent(this, BluetoothOppTransferActivity.class);
            Intent in = new Intent(this, BluetoothOppTransferActivity.class);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setData(contentUri);
            in.setDataAndNormalize(contentUri);
            this.startActivity(in);
            this.startActivity(in);
        }
        }
    }
    }
Loading