OverlayTouchActivity.java revision 5c07dcb0698725e7949b030665d21f96c916f3b8
15c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk/*
25c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * Copyright (C) 2015 The Android Open Source Project
35c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk *
45c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * Licensed under the Apache License, Version 2.0 (the "License");
55c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * you may not use this file except in compliance with the License.
65c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * You may obtain a copy of the License at
75c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk *
85c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk *      http://www.apache.org/licenses/LICENSE-2.0
95c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk *
105c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * Unless required by applicable law or agreed to in writing, software
115c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * distributed under the License is distributed on an "AS IS" BASIS,
125c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * See the License for the specific language governing permissions and
145c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk * limitations under the License.
155c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk */
165c07dcb0698725e7949b030665d21f96c916f3b8Jason Monkpackage com.android.packageinstaller.permission.ui;
175c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
185c07dcb0698725e7949b030665d21f96c916f3b8Jason Monkimport android.app.Activity;
195c07dcb0698725e7949b030665d21f96c916f3b8Jason Monkimport android.content.Intent;
205c07dcb0698725e7949b030665d21f96c916f3b8Jason Monkimport android.view.MotionEvent;
215c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
225c07dcb0698725e7949b030665d21f96c916f3b8Jason Monkpublic class OverlayTouchActivity extends Activity {
235c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
245c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    private boolean mObscuredTouch;
255c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
265c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    public boolean isObscuredTouch() {
275c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk        return mObscuredTouch;
285c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    }
295c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
305c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    @Override
315c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    public boolean dispatchTouchEvent(MotionEvent event) {
325c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk        mObscuredTouch = (event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0;
335c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk        return super.dispatchTouchEvent(event);
345c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    }
355c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk
365c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    public void showOverlayDialog() {
375c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk        startActivity(new Intent(this, OverlayWarningDialog.class));
385c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk    }
395c07dcb0698725e7949b030665d21f96c916f3b8Jason Monk}
40