Merge "Remove touch listener on UsbDebuggingActivity" into rvc-dev

This commit is contained in:
Beverly Tai
2020-05-15 19:33:26 +00:00
committed by Android (Google) Code Review

View File

@@ -23,15 +23,12 @@ import android.debug.IAdbManager;
import android.os.Bundle;
import android.os.IBinder;
import android.os.ServiceManager;
import android.util.EventLog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.Toast;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
@@ -79,25 +76,6 @@ public class UsbDebuggingActivity extends AlertActivity
window.setCloseOnTouchOutside(false);
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