Remove old java based home application
|
|
@ -1,53 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="org.anbox" >
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INJECT_EVENTS" />
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
|
||||||
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
|
||||||
<uses-permission android:name="android.permission.STATUS_BAR" />
|
|
||||||
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
|
|
||||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:name=".MainApplication"
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/AppTheme" >
|
|
||||||
|
|
||||||
<receiver
|
|
||||||
android:name=".BootReceiver"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true" >
|
|
||||||
<intent-filter android:priority="1000" >
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".NotificationListener"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true"
|
|
||||||
android:label="@string/service_name"
|
|
||||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.service.notification.NotificationListenerService" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".NavBar"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true" >
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.anbox.NavBar"/>
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# Android Anbox service
|
|
||||||
|
|
||||||
This is based on shashlikd from https://github.com/shashlik/shashlikd
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
|
|
||||||
public final class BuildConfig {
|
|
||||||
public final static boolean DEBUG = Boolean.parseBoolean(null);
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
|
|
||||||
public final class Manifest {
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
/*___Generated_by_IDEA___*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
|
|
||||||
public final class R {
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
|
|
||||||
public class ApplicationManager {
|
|
||||||
static final String TAG = "AnboxApplicationManager";
|
|
||||||
|
|
||||||
public ApplicationManager() {
|
|
||||||
Log.i(TAG, "Starting up native part..");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.os.StrictMode;
|
|
||||||
import java.lang.Process;
|
|
||||||
import java.lang.ProcessBuilder;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import android.net.Uri;
|
|
||||||
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class BootReceiver extends BroadcastReceiver {
|
|
||||||
public BootReceiver() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
MainApplication app = ((MainApplication) context.getApplicationContext());
|
|
||||||
app.startServices();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,252 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.hardware.input.InputManager;
|
|
||||||
import android.media.AudioManager;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.HapticFeedbackConstants;
|
|
||||||
import android.view.InputDevice;
|
|
||||||
import android.view.KeyCharacterMap;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.SoundEffectConstants;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewConfiguration;
|
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
//import org.anbox.R;
|
|
||||||
|
|
||||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
|
|
||||||
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK;
|
|
||||||
|
|
||||||
public class KeyButtonView extends ImageView {
|
|
||||||
private static final String TAG = "StatusBar.KeyButtonView";
|
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
|
|
||||||
// TODO: Get rid of this
|
|
||||||
public static final float DEFAULT_QUIESCENT_ALPHA = 1f;
|
|
||||||
|
|
||||||
private long mDownTime;
|
|
||||||
private int mCode;
|
|
||||||
private int mTouchSlop;
|
|
||||||
private float mDrawingAlpha = 1f;
|
|
||||||
private float mQuiescentAlpha = DEFAULT_QUIESCENT_ALPHA;
|
|
||||||
private boolean mSupportsLongpress = true;
|
|
||||||
private AudioManager mAudioManager;
|
|
||||||
private Animator mAnimateToQuiescent = new ObjectAnimator();
|
|
||||||
|
|
||||||
private final Runnable mCheckLongPress = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
if (isPressed()) {
|
|
||||||
// Log.d("KeyButtonView", "longpressed: " + this);
|
|
||||||
if (isLongClickable()) {
|
|
||||||
// Just an old-fashioned ImageView
|
|
||||||
performLongClick();
|
|
||||||
} else {
|
|
||||||
sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
|
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public KeyButtonView(Context context, AttributeSet attrs) {
|
|
||||||
this(context, attrs, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyButtonView(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs);
|
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.KeyButtonView,
|
|
||||||
defStyle, 0);
|
|
||||||
|
|
||||||
mCode = a.getInteger(R.styleable.KeyButtonView_keyCode, 0);
|
|
||||||
|
|
||||||
mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true);
|
|
||||||
|
|
||||||
|
|
||||||
setDrawingAlpha(mQuiescentAlpha);
|
|
||||||
|
|
||||||
a.recycle();
|
|
||||||
|
|
||||||
setClickable(true);
|
|
||||||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
|
|
||||||
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
|
||||||
//setBackground(new KeyButtonRipple(context, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
|
||||||
super.onInitializeAccessibilityNodeInfo(info);
|
|
||||||
if (mCode != 0) {
|
|
||||||
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(ACTION_CLICK, null));
|
|
||||||
if (mSupportsLongpress) {
|
|
||||||
info.addAction(
|
|
||||||
new AccessibilityNodeInfo.AccessibilityAction(ACTION_LONG_CLICK, null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onWindowVisibilityChanged(int visibility) {
|
|
||||||
super.onWindowVisibilityChanged(visibility);
|
|
||||||
if (visibility != View.VISIBLE) {
|
|
||||||
jumpDrawablesToCurrentState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
|
||||||
if (action == ACTION_CLICK && mCode != 0) {
|
|
||||||
sendEvent(KeyEvent.ACTION_DOWN, 0, SystemClock.uptimeMillis());
|
|
||||||
sendEvent(KeyEvent.ACTION_UP, 0);
|
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
|
|
||||||
playSoundEffect(SoundEffectConstants.CLICK);
|
|
||||||
return true;
|
|
||||||
} else if (action == ACTION_LONG_CLICK && mCode != 0 && mSupportsLongpress) {
|
|
||||||
sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS);
|
|
||||||
sendEvent(KeyEvent.ACTION_UP, 0);
|
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.performAccessibilityAction(action, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuiescentAlpha(float alpha, boolean animate) {
|
|
||||||
mAnimateToQuiescent.cancel();
|
|
||||||
alpha = Math.min(Math.max(alpha, 0), 1);
|
|
||||||
if (alpha == mQuiescentAlpha && alpha == mDrawingAlpha) return;
|
|
||||||
mQuiescentAlpha = alpha;
|
|
||||||
if (DEBUG) Log.d(TAG, "New quiescent alpha = " + mQuiescentAlpha);
|
|
||||||
if (animate) {
|
|
||||||
mAnimateToQuiescent = animateToQuiescent();
|
|
||||||
mAnimateToQuiescent.start();
|
|
||||||
} else {
|
|
||||||
setDrawingAlpha(mQuiescentAlpha);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObjectAnimator animateToQuiescent() {
|
|
||||||
return ObjectAnimator.ofFloat(this, "drawingAlpha", mQuiescentAlpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getQuiescentAlpha() {
|
|
||||||
return mQuiescentAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getDrawingAlpha() {
|
|
||||||
return mDrawingAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDrawingAlpha(float x) {
|
|
||||||
setImageAlpha((int) (x * 255));
|
|
||||||
mDrawingAlpha = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTouchEvent(MotionEvent ev) {
|
|
||||||
final int action = ev.getAction();
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
mDownTime = SystemClock.uptimeMillis();
|
|
||||||
setPressed(true);
|
|
||||||
if (mCode != 0) {
|
|
||||||
sendEvent(KeyEvent.ACTION_DOWN, 0, mDownTime);
|
|
||||||
} else {
|
|
||||||
// Provide the same haptic feedback that the system offers for virtual keys.
|
|
||||||
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
|
||||||
}
|
|
||||||
if (mSupportsLongpress) {
|
|
||||||
removeCallbacks(mCheckLongPress);
|
|
||||||
postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
x = (int)ev.getX();
|
|
||||||
y = (int)ev.getY();
|
|
||||||
setPressed(x >= -mTouchSlop
|
|
||||||
&& x < getWidth() + mTouchSlop
|
|
||||||
&& y >= -mTouchSlop
|
|
||||||
&& y < getHeight() + mTouchSlop);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
setPressed(false);
|
|
||||||
if (mCode != 0) {
|
|
||||||
sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_CANCELED);
|
|
||||||
}
|
|
||||||
if (mSupportsLongpress) {
|
|
||||||
removeCallbacks(mCheckLongPress);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
final boolean doIt = isPressed();
|
|
||||||
setPressed(false);
|
|
||||||
if (mCode != 0) {
|
|
||||||
if (doIt) {
|
|
||||||
sendEvent(KeyEvent.ACTION_UP, 0);
|
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
|
|
||||||
playSoundEffect(SoundEffectConstants.CLICK);
|
|
||||||
} else {
|
|
||||||
sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_CANCELED);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// no key code, just a regular ImageView
|
|
||||||
if (doIt) {
|
|
||||||
performClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mSupportsLongpress) {
|
|
||||||
removeCallbacks(mCheckLongPress);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void playSoundEffect(int soundConstant) {
|
|
||||||
// mAudioManager.playSoundEffect(soundConstant, ActivityManager.getCurrentUser());
|
|
||||||
};
|
|
||||||
|
|
||||||
public void sendEvent(int action, int flags) {
|
|
||||||
sendEvent(action, flags, SystemClock.uptimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendEvent(int action, int flags, long when) {
|
|
||||||
final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
|
|
||||||
final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,
|
|
||||||
0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
|
|
||||||
flags | KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY,
|
|
||||||
InputDevice.SOURCE_KEYBOARD);
|
|
||||||
InputManager.getInstance().injectInputEvent(ev,
|
|
||||||
InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
startService(new Intent(MainActivity.this, NotificationListener.class));
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
|
||||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
// Handle action bar item clicks here. The action bar will
|
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
|
||||||
int id = item.getItemId();
|
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
|
||||||
if (id == R.id.action_settings) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
|
|
||||||
public class MainApplication extends Application {
|
|
||||||
private ApplicationManager mApplicationManager;
|
|
||||||
private NavBar mNavBar;
|
|
||||||
|
|
||||||
public MainApplication() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startServices() {
|
|
||||||
mApplicationManager = new ApplicationManager();
|
|
||||||
mNavBar = new NavBar(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
public class NavBar extends Service {
|
|
||||||
private NavigationBarView mNavigationBarView = null;
|
|
||||||
private Context mContext;
|
|
||||||
private WindowManager mWindowManager;
|
|
||||||
|
|
||||||
public NavBar(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
mNavigationBarView =
|
|
||||||
(NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);
|
|
||||||
|
|
||||||
mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
|
|
||||||
mWindowManager.addView(mNavigationBarView, getNavigationBarLayoutParams());
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private WindowManager.LayoutParams getNavigationBarLayoutParams() {
|
|
||||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
|
||||||
WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT,
|
|
||||||
WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW+19, //TYPE_NAVIGATION_BAR, Private API, which for some reason I can't include...
|
|
||||||
0
|
|
||||||
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
|
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
|
||||||
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
|
|
||||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
|
||||||
PixelFormat.TRANSLUCENT);
|
|
||||||
// this will allow the navbar to run in an overlay on devices that support this
|
|
||||||
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
|
|
||||||
|
|
||||||
lp.setTitle("NavigationBar");
|
|
||||||
lp.windowAnimations = 0;
|
|
||||||
return lp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show() {
|
|
||||||
WindowManager.LayoutParams lp =
|
|
||||||
(android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
|
|
||||||
lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
|
||||||
|
|
||||||
|
|
||||||
mWindowManager.updateViewLayout(mNavigationBarView, lp);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hide() {
|
|
||||||
WindowManager.LayoutParams lp =
|
|
||||||
(android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
|
|
||||||
lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
|
||||||
mWindowManager.updateViewLayout(mNavigationBarView, lp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
|
|
||||||
public class NavigationBarView extends LinearLayout {
|
|
||||||
public NavigationBarView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 3, as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranties of
|
|
||||||
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.anbox;
|
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.service.notification.NotificationListenerService;
|
|
||||||
import android.service.notification.StatusBarNotification;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class NotificationListener extends NotificationListenerService {
|
|
||||||
public NotificationListener() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
return super.onBind(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onListenerConnected() {
|
|
||||||
super.onListenerConnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNotificationPosted(StatusBarNotification sbn) {
|
|
||||||
Log.e("Anbox", "new notification");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 486 B |
|
Before Width: | Height: | Size: 964 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1,006 B |
|
Before Width: | Height: | Size: 530 B |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 733 B |
|
Before Width: | Height: | Size: 895 B |
|
Before Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 404 B |
|
Before Width: | Height: | Size: 981 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 1,016 B |
|
Before Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 738 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 178 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 942 B |
|
Before Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 629 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 317 B |
|
Before Width: | Height: | Size: 582 B |
|
Before Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 846 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 796 B |
|
Before Width: | Height: | Size: 1,009 B |
|
Before Width: | Height: | Size: 908 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 409 B |