Merge "Remove touch listener on UsbDebuggingActivity" into rvc-dev am: d8f1c69a68

Change-Id: Idb9f2b3224b2d65b4d84cb66a9e393c9c9862fdc
This commit is contained in:
Beverly Tai
2020-05-15 19:49:28 +00:00
committed by Automerger Merge Worker

View File

@@ -23,15 +23,12 @@ import android.debug.IAdbManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.Toast;
import com.android.internal.app.AlertActivity; import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController; import com.android.internal.app.AlertController;
@@ -79,25 +76,6 @@ public class UsbDebuggingActivity extends AlertActivity
window.setCloseOnTouchOutside(false); window.setCloseOnTouchOutside(false);
setupAlert(); setupAlert();
// adding touch listener on affirmative button - checks if window is obscured
// if obscured, do not let user give permissions (could be tapjacking involved)
final View.OnTouchListener filterTouchListener = (View v, MotionEvent event) -> {
// Filter obscured touches by consuming them.
if (((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0)
|| ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED) != 0)) {
if (event.getAction() == MotionEvent.ACTION_UP) {
EventLog.writeEvent(0x534e4554, "62187985"); // safety net logging
Toast.makeText(v.getContext(),
R.string.touch_filtered_warning,
Toast.LENGTH_SHORT).show();
}
return true;
}
return false;
};
mAlert.getButton(BUTTON_POSITIVE).setOnTouchListener(filterTouchListener);
} }
@Override @Override