rhodes 7.5.1 → 7.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +319 -0
- data/README.md +3 -15
- data/Rakefile +3 -0
- data/appveyor.yml +37 -32
- data/azure-pipelines.yml +1 -1
- data/bin/rhodes-setup +22 -8
- data/extensions/emdk3-manager/ext/platform/android/src/com/rho/emdk3/EMDK3Extension.java +14 -5
- data/extensions/instrumentation/ext/platform/android/src/com/rho/instrumentation/Instrumentation.java +29 -15
- data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +1 -1
- data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/ElementsCore.java +12 -9
- data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/graphics/BatteryIndicator.java +2 -2
- data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro +1 -1
- data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro.erb +2 -2
- data/lib/commonAPI/barcode/ext/platform/qt/src/qzxing/QZXing.pri +9 -21
- data/lib/commonAPI/barcode/ext.yml +1 -0
- data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro +1 -1
- data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro.erb +1 -1
- data/lib/commonAPI/bluetooth/ext/platform/qt/src/bluetooth/bluetoothhelper.h +1 -1
- data/lib/commonAPI/coreapi/RhoSystemApi.rb +6 -0
- data/lib/commonAPI/coreapi/ext/Intent.xml +4 -0
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/intent/IntentSingleton.java +6 -0
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +2 -1
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +1 -1
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/webview/WebViewSingleton.java +40 -27
- data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +5 -6
- data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.h +1 -1
- data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.m +3 -1
- data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.h +2 -1
- data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.m +10 -0
- data/lib/commonAPI/coreapi/ext/platform/wm/src/IntentImpl.cpp +3 -0
- data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.cpp +13 -0
- data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.h +2 -0
- data/lib/commonAPI/coreapi/ext/system.xml +3 -0
- data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationCameraActivity.erb +2 -2
- data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
- data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +1 -0
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +8 -4
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +8 -0
- data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/mediacapture/RhoCameraFileProvider.java +6 -0
- data/lib/commonAPI/mediacapture/ext/platform/qt/MediaCapture.pro.erb +1 -1
- data/lib/commonAPI/mediacapture/ext/platform/qt/Mediacapture.pro +1 -1
- data/lib/commonAPI/signature/ext/platform/iphone/impl/readme.txt +7 -0
- data/lib/commonAPI/signature/ext/platform/qt/Signature.pro +3 -10
- data/lib/commonAPI/signature/ext/platform/qt/Signature.pro.erb +2 -2
- data/lib/extensions/fcm-push/ext/iphone/Podfile +15 -2
- data/lib/extensions/fcm-push/ext/iphone/fcm-push.xcodeproj/project.pbxproj +6 -7
- data/lib/extensions/nfc/ext/platform/android/src/com/rhomobile/nfc/Nfc.java +2 -1
- data/lib/extensions/serialport/ext/serialport.pro +1 -1
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +4 -0
- data/platform/android/Rhodes/res/drawable/baseline_check_24.xml +5 -0
- data/platform/android/Rhodes/res/drawable/baseline_check_240.xml +5 -0
- data/platform/android/Rhodes/res/drawable/baseline_close_24.xml +5 -0
- data/platform/android/Rhodes/res/drawable/baseline_close_240.xml +5 -0
- data/platform/android/Rhodes/res/layout/overlay_layout.xml +39 -0
- data/platform/android/Rhodes/res/layout/perrmission_alert_dialog.xml +267 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +183 -66
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +38 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoFileProvider.java +32 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +529 -89
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +256 -160
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +14 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +5 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +79 -38
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +6 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/CallReceiver.java +22 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/IKioskMode.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/KioskManager.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java +230 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyNotificationListenerService.java +16 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyOverlayService.java +197 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/PermissionManager.java +232 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +34 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/CheckDrawable.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/PermissionListGenerate.java +366 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/rhodes.iml +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +782 -41
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputConnectionWrapper.java +146 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputListener.java +21 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +92 -32
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/TauWebViewOptions.java +118 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderBase.java +18 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderEclairMR1.java +4 -4
- data/platform/android/build/RhodesSRC_build.files +13 -0
- data/platform/android/build/android-repack.rake +8 -1
- data/platform/android/build/android.rake +118 -51
- data/platform/android/build/android_tools.rb +1 -1
- data/platform/android/build/androidcommon.rb +13 -7
- data/platform/android/build/config.yml +4 -1
- data/platform/android/build/manifest_generator.rb +14 -10
- data/platform/android/build/maven_deps_extractor.rb +7 -1
- data/platform/android/build/ndkwrapper.rb +12 -0
- data/platform/android/proguard/proguard-base-rules.pro +5 -0
- data/platform/android/proguard/proguard.jar +0 -0
- data/platform/iphone/Classes/RhoAppBaseLib-Bridging-Header.h +4 -0
- data/platform/iphone/Classes/RhoAppBaseStandaloneLib-Bridging-Header.h +4 -0
- data/platform/iphone/Classes/RhoCryptAESGCM.swift +105 -0
- data/platform/iphone/Classes/RhoUIWebView.h +1 -1
- data/platform/iphone/Classes/RhoUIWebView.m +1 -1
- data/platform/iphone/Classes/RhoWKWebView.h +1 -1
- data/platform/iphone/Classes/RhoWKWebView.mm +32 -4
- data/platform/iphone/Classes/RhoWebView.h +1 -1
- data/platform/iphone/Classes/RhoWebViewFabrique.m +7 -1
- data/platform/iphone/Classes/SimpleMainView.m +5 -5
- data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -10
- data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -0
- data/platform/iphone/Framework/RhoApplication/RhoApplication.xcodeproj/project.pbxproj +1 -1
- data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1 -1
- data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +46 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +1 -1
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rbuild/iphone.rake +9 -8
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +1 -1
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
- data/platform/sailfish/build/{harbour-SailfishRhodes.pro.erb → SailfishRhodes.pro.erb} +10 -17
- data/platform/sailfish/build/rhodes.pro.erb +7 -17
- data/platform/sailfish/build/rpm/SailfishRhodes.desktop.erb +12 -0
- data/platform/sailfish/build/rpm/SailfishRhodes.erb +2 -0
- data/platform/sailfish/build/rpm/SailfishRhodes.spec.erb +43 -0
- data/platform/sailfish/build/rubylib.pro.erb +29 -29
- data/platform/sailfish/build/sailfish.rake +188 -180
- data/platform/sailfish/keys/regular_cert.pem +14 -0
- data/platform/sailfish/keys/regular_key.pem +4 -0
- data/platform/shared/common/RhodesApp.cpp +33 -9
- data/platform/shared/common/iphone/RhoCryptImpl.mm +130 -54
- data/platform/shared/qt/RhoSimulator.pro +1 -1
- data/platform/shared/qt/rhodes/rhodes.pro +4 -11
- data/platform/shared/qt/sailfish/SailfishRhodes.desktop +3 -4
- data/platform/shared/qt/sailfish/SailfishRhodes.pro +9 -10
- data/platform/shared/qt/sailfish/icons/108x108/108x108.png +0 -0
- data/platform/shared/qt/sailfish/privileges/sailfishrhodes +2 -0
- data/platform/shared/qt/sailfish/qml/pages/FirstPageWK.qml +7 -11
- data/platform/shared/qt/sailfish/qml/{harbour-sailfishrhodes.qml → sailfishrhodes.qml} +1 -1
- data/platform/shared/qt/sailfish/rpm/sailfishrhodes.spec +80 -0
- data/platform/shared/qt/sailfish/rpm/{harbour-sailfishrhodes.yaml → sailfishrhodes.yaml} +2 -2
- data/platform/shared/qt/sailfish/src/QtMainWindow.cpp +1 -1
- data/platform/shared/qt/sailfish/src/QtMainWindow.h +1 -1
- data/platform/shared/qt/sailfish/src/main.cpp +6 -38
- data/platform/shared/qt/sailfish/src/rootdelegate.h +2 -14
- data/platform/shared/ruby/aurora/ruby/config.h +386 -0
- data/platform/shared/ruby/aurora/ruby/constdefs.c +5866 -0
- data/platform/shared/ruby/aurora/ruby/constdefs.h +1788 -0
- data/platform/shared/sqlite/crypto.c +14 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/build/rhodes.nsi +3 -3
- data/platform/win32/build/win32.rake +1 -1
- data/rakefile.rb +3 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim_8 +4 -4
- data/res/generators/templates/application/AndroidManifest.erb +26 -5
- data/res/generators/templates/application/build.yml +14 -10
- data/res/generators/templates/application/resources/android/res/xml/provider_paths.xml +4 -0
- data/res/generators/templates/application/rhoconfig.txt +10 -1
- data/res/generators/templates/iphone_project/Bremen8.xcodeproj/project.pbxproj +24 -1
- data/res/generators/templates/iphone_project/Classes/SimpleSwiftClass.swift +20 -0
- data/res/generators/templates/iphone_project/Classes/rhorunner-Bridging-Header.h +4 -0
- data/rhobuild.yml.example +3 -3
- data/rhodes.gemspec +4 -2
- data/version +1 -1
- metadata +81 -26
- data/platform/sailfish/build/rho_build.cmd.erb +0 -14
- data/platform/sailfish/build/rho_clean.cmd.erb +0 -14
- data/platform/sailfish/build/rho_deploy.cmd.erb +0 -15
- data/platform/sailfish/build/rho_rpm.cmd.erb +0 -14
- data/platform/sailfish/build/rho_rpmvalidation.cmd.erb +0 -14
- data/platform/sailfish/build/rpm/harbour-SailfishRhodes.desktop.erb +0 -7
- data/platform/sailfish/build/rpm/harbour-SailfishRhodes.erb +0 -2
- data/platform/sailfish/build/rpm/harbour-SailfishRhodes.yaml.erb +0 -37
- data/platform/shared/qt/sailfish/harbour-sailfishrhodes.desktop +0 -6
- data/platform/shared/qt/sailfish/icons/108x108/harbour-sailfishrhodes.png +0 -0
- data/platform/shared/qt/sailfish/privileges/harbour-sailfishrhodes +0 -2
- data/platform/shared/qt/sailfish/qml/pages/FirstPageWE.qml +0 -236
- /data/platform/shared/qt/sailfish/icons/128x128/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
- /data/platform/shared/qt/sailfish/icons/172x172/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
- /data/platform/shared/qt/sailfish/icons/86x86/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
package com.rhomobile.rhodes.kioskservices;
|
2
|
+
|
3
|
+
import android.app.Service;
|
4
|
+
import android.content.Intent;
|
5
|
+
import android.graphics.PixelFormat;
|
6
|
+
import android.os.IBinder;
|
7
|
+
import android.view.View;
|
8
|
+
import android.view.WindowManager;
|
9
|
+
import android.widget.Button;
|
10
|
+
import android.widget.LinearLayout;
|
11
|
+
import android.widget.FrameLayout;
|
12
|
+
import android.util.Log;
|
13
|
+
|
14
|
+
import com.rhomobile.rhodes.RhodesActivity;
|
15
|
+
import com.rhomobile.rhodes.mainview.MainView;
|
16
|
+
|
17
|
+
import android.view.Gravity;
|
18
|
+
import java.util.Vector;
|
19
|
+
|
20
|
+
import com.rhomobile.rhodes.Logger;
|
21
|
+
|
22
|
+
import androidx.annotation.Nullable;
|
23
|
+
|
24
|
+
import com.rhomobile.rhodes.R;
|
25
|
+
|
26
|
+
public class MyOverlayService extends Service {
|
27
|
+
|
28
|
+
private final static String TAG = "MyOverlayService";
|
29
|
+
|
30
|
+
private WindowManager wm;
|
31
|
+
private LinearLayout overlayLayout;
|
32
|
+
private FrameLayout mFrameLayout = null;
|
33
|
+
|
34
|
+
private MainView mMainView = null;
|
35
|
+
|
36
|
+
private static MyOverlayService ourInstance = null;
|
37
|
+
|
38
|
+
private static boolean ourIsOverlayModeEnabled = false;
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
public interface MyOverlayServiceListener {
|
43
|
+
void onOverlayStart(MyOverlayService overlayService, FrameLayout mainLayout);
|
44
|
+
void onOverlayStop(MyOverlayService overlayService, FrameLayout mainLayout);
|
45
|
+
}
|
46
|
+
|
47
|
+
private static Vector<MyOverlayServiceListener> ourListeners = new Vector<MyOverlayServiceListener>(1);
|
48
|
+
|
49
|
+
public static MyOverlayService getInstance() {
|
50
|
+
return ourInstance;
|
51
|
+
}
|
52
|
+
|
53
|
+
public static void addListener(MyOverlayServiceListener listener) {
|
54
|
+
ourListeners.addElement(listener);
|
55
|
+
}
|
56
|
+
|
57
|
+
private void callListsnersOnStart() {
|
58
|
+
for(int i=0; i < ourListeners.size(); ++i) {
|
59
|
+
ourListeners.get(i).onOverlayStart(this, mFrameLayout);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
@Nullable
|
64
|
+
@Override
|
65
|
+
public IBinder onBind(Intent intent) {
|
66
|
+
Logger.T(TAG, "$$$ onBind() ");
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
public static boolean isOverlayMode() {
|
72
|
+
return ourIsOverlayModeEnabled;
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
public void stopOverlayMode() {
|
78
|
+
Logger.T(TAG, "$$$ stopOverlayMode() ");
|
79
|
+
ourInstance = null;
|
80
|
+
ourIsOverlayModeEnabled = false;
|
81
|
+
if (mMainView != null) {
|
82
|
+
mFrameLayout.removeAllViews();
|
83
|
+
overlayLayout.removeAllViews();
|
84
|
+
RhodesActivity.safeGetInstance().setMainView(mMainView);
|
85
|
+
mMainView = null;
|
86
|
+
}
|
87
|
+
stopSelf();
|
88
|
+
}
|
89
|
+
|
90
|
+
@Override
|
91
|
+
public int onStartCommand(Intent intent, int flags, int startId) {
|
92
|
+
Logger.T(TAG, "$$$ onStartCommand() ");
|
93
|
+
if (ourInstance != null) {
|
94
|
+
//return super.onStartCommand(intent, flags, startId);
|
95
|
+
}
|
96
|
+
ourInstance = this;
|
97
|
+
ourIsOverlayModeEnabled = true;
|
98
|
+
|
99
|
+
wm = (WindowManager) getSystemService(WINDOW_SERVICE);
|
100
|
+
|
101
|
+
if (overlayLayout != null) {
|
102
|
+
wm.removeView(overlayLayout);
|
103
|
+
overlayLayout = null;
|
104
|
+
}
|
105
|
+
|
106
|
+
overlayLayout = new LinearLayout(this);
|
107
|
+
overlayLayout.setOrientation(LinearLayout.VERTICAL);
|
108
|
+
overlayLayout.setBackgroundColor(0xFFFFFFFF);
|
109
|
+
|
110
|
+
// Button btnClose = new Button(this);
|
111
|
+
// btnClose.setText("STOP OVERLAY");
|
112
|
+
// btnClose.setOnClickListener(new View.OnClickListener() {
|
113
|
+
// @Override
|
114
|
+
// public void onClick(View v){
|
115
|
+
// stopOverlayMode();
|
116
|
+
// }
|
117
|
+
// });
|
118
|
+
|
119
|
+
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
120
|
+
FrameLayout.LayoutParams.WRAP_CONTENT,
|
121
|
+
FrameLayout.LayoutParams.WRAP_CONTENT
|
122
|
+
);
|
123
|
+
lparams.topMargin = 8;
|
124
|
+
lparams.bottomMargin = 8;
|
125
|
+
lparams.leftMargin = 8;
|
126
|
+
lparams.rightMargin = 8;
|
127
|
+
|
128
|
+
// overlayLayout.addView(btnClose, lparams);
|
129
|
+
|
130
|
+
/*
|
131
|
+
|
|
132
|
+
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
|
133
|
+
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
|
134
|
+
*/
|
135
|
+
|
136
|
+
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
|
137
|
+
WindowManager.LayoutParams.MATCH_PARENT,
|
138
|
+
WindowManager.LayoutParams.MATCH_PARENT,
|
139
|
+
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
|
140
|
+
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
141
|
+
PixelFormat.TRANSLUCENT
|
142
|
+
);
|
143
|
+
|
144
|
+
mFrameLayout = new FrameLayout(this);
|
145
|
+
|
146
|
+
|
147
|
+
FrameLayout.LayoutParams wvlparams = new FrameLayout.LayoutParams(
|
148
|
+
FrameLayout.LayoutParams.MATCH_PARENT,
|
149
|
+
FrameLayout.LayoutParams.MATCH_PARENT
|
150
|
+
);
|
151
|
+
|
152
|
+
mMainView = RhodesActivity.extractMainView();
|
153
|
+
if(mMainView != null){
|
154
|
+
if(mMainView != null){
|
155
|
+
Logger.T(TAG, "$$$ mMainView != NULL ! class = "+mMainView.getClass().getSimpleName());
|
156
|
+
}else{
|
157
|
+
Logger.T(TAG, "$$$ mMainView == NULL ! ");
|
158
|
+
}
|
159
|
+
|
160
|
+
mFrameLayout.addView(mMainView.getView(), wvlparams);
|
161
|
+
}
|
162
|
+
|
163
|
+
callListsnersOnStart();
|
164
|
+
|
165
|
+
overlayLayout.addView(RhodesActivity.onOverlayStarted(mFrameLayout), lparams);
|
166
|
+
|
167
|
+
|
168
|
+
wm.addView(overlayLayout, params);
|
169
|
+
|
170
|
+
return super.onStartCommand(intent, flags, startId);
|
171
|
+
}
|
172
|
+
|
173
|
+
@Override
|
174
|
+
public void onDestroy() {
|
175
|
+
Log.d("myLog", "Overlay stop");
|
176
|
+
Logger.T(TAG, "onDestroy()");
|
177
|
+
ourInstance = null;
|
178
|
+
ourIsOverlayModeEnabled = false;
|
179
|
+
super.onDestroy();
|
180
|
+
try {
|
181
|
+
if (mMainView != null) {
|
182
|
+
mFrameLayout.removeAllViews();
|
183
|
+
overlayLayout.removeAllViews();
|
184
|
+
RhodesActivity.safeGetInstance().setMainView(mMainView);
|
185
|
+
mMainView = null;
|
186
|
+
}
|
187
|
+
if (overlayLayout != null) {
|
188
|
+
wm.removeView(overlayLayout);
|
189
|
+
overlayLayout = null;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
catch(Exception e) {
|
193
|
+
|
194
|
+
}
|
195
|
+
overlayLayout = null;
|
196
|
+
}
|
197
|
+
}
|
@@ -0,0 +1,232 @@
|
|
1
|
+
package com.rhomobile.rhodes.kioskservices;
|
2
|
+
|
3
|
+
import android.Manifest;
|
4
|
+
import android.accessibilityservice.AccessibilityServiceInfo;
|
5
|
+
import android.app.Activity;
|
6
|
+
import android.content.ComponentName;
|
7
|
+
import android.content.Context;
|
8
|
+
import android.content.Intent;
|
9
|
+
import android.content.IntentFilter;
|
10
|
+
import android.content.pm.PackageManager;
|
11
|
+
import android.net.Uri;
|
12
|
+
import android.provider.Settings;
|
13
|
+
import android.view.accessibility.AccessibilityManager;
|
14
|
+
import android.widget.Toast;
|
15
|
+
|
16
|
+
|
17
|
+
import androidx.core.app.ActivityCompat;
|
18
|
+
import androidx.core.content.ContextCompat;
|
19
|
+
import java.util.function.Predicate;
|
20
|
+
|
21
|
+
import com.rhomobile.rhodes.RhoConf;
|
22
|
+
import com.rhomobile.rhodes.extmanager.RhoExtManager;
|
23
|
+
import com.rhomobile.rhodes.util.PerformOnUiThread;
|
24
|
+
|
25
|
+
|
26
|
+
import java.util.ArrayList;
|
27
|
+
import java.util.Arrays;
|
28
|
+
import java.util.List;
|
29
|
+
import java.util.stream.Collectors;
|
30
|
+
|
31
|
+
public class PermissionManager {
|
32
|
+
final static private Integer MY_PERMISSIONS_REQUEST = 343457842;
|
33
|
+
|
34
|
+
static public Boolean checkPermissions(Context context, Activity activity){
|
35
|
+
boolean callPhonePermissionIgnor = RhoConf.isExist("call_phone_permission_ignor") && RhoConf.getBool("call_phone_permission_ignor");
|
36
|
+
boolean callPhonePermission = true;
|
37
|
+
if(!callPhonePermissionIgnor)
|
38
|
+
callPhonePermission = checkCallPhonePermission(context);
|
39
|
+
|
40
|
+
return checkAccessibilityServicePermission(context)
|
41
|
+
&& checkNotificationServicePermission(activity, context)
|
42
|
+
&& isMyLauncherDefault(context)
|
43
|
+
&& callPhonePermission
|
44
|
+
&& checkOverlayPermission(context);
|
45
|
+
}
|
46
|
+
|
47
|
+
static public void setAllPermissions(Context context, Activity activity){
|
48
|
+
if (!checkAccessibilityServicePermission(context))
|
49
|
+
setAccessibilityServicePermission(activity);
|
50
|
+
else if(!checkNotificationServicePermission(activity, context))
|
51
|
+
setNotificationServicePermission(activity);
|
52
|
+
else if(!isMyLauncherDefault(context))
|
53
|
+
setDefaultLauncher(activity);
|
54
|
+
else if(!checkCallPhonePermission(context))
|
55
|
+
setCallPhonePermission(activity);
|
56
|
+
else if(!checkOverlayPermission(context))
|
57
|
+
setOverlayPermission(activity);
|
58
|
+
}
|
59
|
+
|
60
|
+
//===================== ACCESSIBILITY SERVICE =====================
|
61
|
+
|
62
|
+
static public Boolean checkAccessibilityServicePermission(Context context){
|
63
|
+
if (MyAccessibilityService.getStatus()){
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
|
67
|
+
AccessibilityManager am = (AccessibilityManager)context.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
68
|
+
List<AccessibilityServiceInfo> enabledService = am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
|
69
|
+
for (AccessibilityServiceInfo service: enabledService){
|
70
|
+
if(service.getId().equals(getAccessibilityServiceName(context.getPackageName(), MyAccessibilityService.class.getName()))){
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return false;
|
75
|
+
}
|
76
|
+
|
77
|
+
static public void setAccessibilityServicePermission(Activity activity){
|
78
|
+
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
79
|
+
activity.startActivity(intent);
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
static public String getAccessibilityServiceName(String namePackage, String accessibilityService) {
|
84
|
+
String droped = accessibilityService.replace(namePackage, "");
|
85
|
+
System.out.println("WERTYUIOUYTREWERTGYHJKL NamePackage: "+ namePackage+"; accessibilityService"+accessibilityService);
|
86
|
+
System.out.println("WERTYUIOUYTREWERTGYHJKL: "+ namePackage+"/"+droped);
|
87
|
+
return namePackage+"/"+droped;
|
88
|
+
}
|
89
|
+
|
90
|
+
//===================== NOTIFICATION SERVICE =====================
|
91
|
+
|
92
|
+
static public Boolean checkNotificationServicePermission(Activity activity, Context context){
|
93
|
+
String theList = Settings.Secure.getString(activity.getContentResolver(), "enabled_notification_listeners");
|
94
|
+
if (theList == null)
|
95
|
+
theList = "";
|
96
|
+
String[] theListList = theList.split(":", -1);
|
97
|
+
|
98
|
+
List<String> theListListFiltered = new ArrayList<String>();
|
99
|
+
for (String str : theListList){
|
100
|
+
if (!str.isEmpty()) {
|
101
|
+
theListListFiltered.add(str.toString());
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
for (String str: theListListFiltered){
|
106
|
+
if(str.equals("")){
|
107
|
+
theListListFiltered.add("");
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
String me = new ComponentName(context, MyNotificationListenerService.class).flattenToString();
|
112
|
+
for (String next : theListListFiltered) {
|
113
|
+
if (me.equals(next))
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
|
119
|
+
static public void setNotificationServicePermission(Activity activity){
|
120
|
+
activity.startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
|
121
|
+
}
|
122
|
+
|
123
|
+
//===================== DEFAULT LAUNCHER =====================
|
124
|
+
|
125
|
+
static public Boolean isMyLauncherDefault(Context context) {
|
126
|
+
IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
|
127
|
+
filter.addCategory(Intent.CATEGORY_HOME);
|
128
|
+
List<IntentFilter> filters = new ArrayList<IntentFilter>();
|
129
|
+
filters.add(filter);
|
130
|
+
String myPackageName = context.getPackageName();
|
131
|
+
List<ComponentName> activities = new ArrayList<ComponentName>();
|
132
|
+
PackageManager packageManager = context.getPackageManager();
|
133
|
+
|
134
|
+
// You can use name of your package here as third argument
|
135
|
+
packageManager.getPreferredActivities(filters, activities, null);
|
136
|
+
for (ComponentName activity : activities) {
|
137
|
+
if (myPackageName.equals(activity.getPackageName())) {
|
138
|
+
return true;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return false;
|
142
|
+
}
|
143
|
+
|
144
|
+
static public void setDefaultLauncher(Activity activity){
|
145
|
+
|
146
|
+
Intent intent = new Intent(Settings.ACTION_HOME_SETTINGS);
|
147
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
148
|
+
activity.startActivity(intent);
|
149
|
+
//Toast.makeText(activity.getApplicationContext(), "PLease select Tau browser with default home app", Toast.LENGTH_LONG).show();
|
150
|
+
RhoExtManager.getInstance().quitApp();
|
151
|
+
|
152
|
+
PerformOnUiThread.exec(new Runnable() {
|
153
|
+
@Override
|
154
|
+
public void run() {
|
155
|
+
System.exit(0);
|
156
|
+
}
|
157
|
+
}, 200);
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
/*
|
162
|
+
mActivity = (RhodesActivity) RhodesActivity.safeGetInstance();
|
163
|
+
kioskMode = (IKioskMode) RhodesActivity.safeGetInstance();
|
164
|
+
|
165
|
+
mActivity.runOnUiThread(new Runnable() {
|
166
|
+
@Override
|
167
|
+
public void run() {
|
168
|
+
//stopBrowserServer();
|
169
|
+
mActivity.stopOverlay();
|
170
|
+
PerformOnUiThread.exec(new Runnable() {
|
171
|
+
@Override
|
172
|
+
public void run() {
|
173
|
+
kioskMode.stopKioskMode();
|
174
|
+
PerformOnUiThread.exec(new Runnable() {
|
175
|
+
@Override
|
176
|
+
public void run() {
|
177
|
+
Intent intent = new Intent(Settings.ACTION_HOME_SETTINGS);
|
178
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
179
|
+
activity.startActivity(intent);
|
180
|
+
Toast.makeText(activity.getApplicationContext(), "PLease select Tau browser with default home app", Toast.LENGTH_LONG).show();
|
181
|
+
//RhoExtManager.getInstance().quitApp();
|
182
|
+
System.exit(0);
|
183
|
+
}
|
184
|
+
}, 500);
|
185
|
+
}
|
186
|
+
}, 500);
|
187
|
+
|
188
|
+
}
|
189
|
+
});
|
190
|
+
*/
|
191
|
+
/*
|
192
|
+
PerformOnUiThread.exec(new Runnable() {
|
193
|
+
@Override
|
194
|
+
public void run() {
|
195
|
+
RhoExtManager.getInstance().quitApp();
|
196
|
+
}
|
197
|
+
}, 500);
|
198
|
+
*/
|
199
|
+
}
|
200
|
+
|
201
|
+
static public void setDefaultLauncherSystem(Context context, Class ClassForLauncher){
|
202
|
+
PackageManager pm = context.getPackageManager();
|
203
|
+
ComponentName cn = new ComponentName(context.getApplicationContext(), ClassForLauncher);
|
204
|
+
|
205
|
+
pm.clearPackagePreferredActivities(context.getPackageName());
|
206
|
+
|
207
|
+
pm.setComponentEnabledSetting(cn, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
208
|
+
pm.setComponentEnabledSetting(cn, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
209
|
+
}
|
210
|
+
|
211
|
+
//===================== CALL PHONE =====================
|
212
|
+
|
213
|
+
static public Boolean checkCallPhonePermission(Context context){
|
214
|
+
return ContextCompat.checkSelfPermission(context, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED;
|
215
|
+
}
|
216
|
+
|
217
|
+
static public void setCallPhonePermission(Activity activity){
|
218
|
+
String[] permissions = {Manifest.permission.CALL_PHONE};
|
219
|
+
ActivityCompat.requestPermissions(activity, permissions, MY_PERMISSIONS_REQUEST);
|
220
|
+
}
|
221
|
+
|
222
|
+
//===================== OVERLAY PERMISSION =====================
|
223
|
+
|
224
|
+
static public Boolean checkOverlayPermission(Context context){
|
225
|
+
return Settings.canDrawOverlays(context);
|
226
|
+
}
|
227
|
+
|
228
|
+
static public void setOverlayPermission(Activity activity){
|
229
|
+
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:"+ activity.getPackageName()));
|
230
|
+
activity.startActivity(intent);
|
231
|
+
}
|
232
|
+
}
|
@@ -35,6 +35,7 @@ import java.io.InputStream;
|
|
35
35
|
import java.util.Map;
|
36
36
|
import java.util.Vector;
|
37
37
|
import java.util.List;
|
38
|
+
import android.os.Looper;
|
38
39
|
|
39
40
|
import com.rhomobile.rhodes.R;
|
40
41
|
import com.rhomobile.rhodes.Logger;
|
@@ -679,6 +680,10 @@ public class SimpleMainView implements MainView {
|
|
679
680
|
|
680
681
|
@Override
|
681
682
|
public void setWebView(IRhoWebView view, int tabIndex) {
|
683
|
+
IRhoWebView rwv = detachWebView();
|
684
|
+
if (rwv != null) {
|
685
|
+
// destory
|
686
|
+
}
|
682
687
|
webView = view;
|
683
688
|
addWebViewToMainView(webView, 0, new LinearLayout.LayoutParams(FILL_PARENT, 0, 1));
|
684
689
|
}
|
@@ -729,18 +734,29 @@ public class SimpleMainView implements MainView {
|
|
729
734
|
}
|
730
735
|
}
|
731
736
|
|
732
|
-
|
737
|
+
|
733
738
|
//@Override
|
734
739
|
public void executeJS(String js, int index) {
|
735
|
-
|
740
|
+
|
736
741
|
//Utils.platformLog("@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@", "ExecuteJS("+js+")");
|
737
742
|
//((android.webkit.WebView)webView.getView()).executeJS();
|
738
743
|
if ((android.os.Build.VERSION.SDK_INT < 14) || (android.os.Build.VERSION.SDK_INT >= 19)) { // 14 is 4.0, 19 is 4.4
|
739
|
-
|
744
|
+
final String js_code = js;
|
745
|
+
if(Looper.getMainLooper().getThread() == Thread.currentThread()) {
|
746
|
+
((WebView)webView.getView()).evaluateJavascript(js_code, null);
|
747
|
+
}
|
748
|
+
else {
|
749
|
+
PerformOnUiThread.exec(new Runnable() {
|
750
|
+
public void run() {
|
751
|
+
((WebView)webView.getView()).evaluateJavascript(js_code, null);
|
752
|
+
}
|
753
|
+
});
|
754
|
+
}
|
755
|
+
//navigate("javascript:"+js, index);
|
740
756
|
return;
|
741
757
|
}
|
742
|
-
|
743
|
-
|
758
|
+
|
759
|
+
|
744
760
|
Method mStringByEvaluatingJavaScriptFromString = null;
|
745
761
|
Method mSendMessage = null;
|
746
762
|
Object mWebViewCore = null;
|
@@ -789,11 +805,21 @@ public class SimpleMainView implements MainView {
|
|
789
805
|
//e.printStackTrace();
|
790
806
|
}
|
791
807
|
}
|
792
|
-
|
808
|
+
|
793
809
|
if (!mHasReflectionWasExecutedOK) {
|
794
810
|
//com.rhomobile.rhodes.WebView.executeJs(js, index);
|
795
|
-
|
796
|
-
|
811
|
+
final String js_code = js;
|
812
|
+
if(Looper.getMainLooper().getThread() == Thread.currentThread()) {
|
813
|
+
((WebView)webView.getView()).evaluateJavascript(js_code, null);
|
814
|
+
}
|
815
|
+
else {
|
816
|
+
PerformOnUiThread.exec(new Runnable() {
|
817
|
+
public void run() {
|
818
|
+
((WebView)webView.getView()).evaluateJavascript(js_code, null);
|
819
|
+
}
|
820
|
+
});
|
821
|
+
}
|
822
|
+
//navigate("javascript:"+js, index);
|
797
823
|
}
|
798
824
|
}
|
799
825
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
package com.rhomobile.rhodes.permissioncheck;
|
2
|
+
|
3
|
+
import android.graphics.Canvas;
|
4
|
+
import android.graphics.Color;
|
5
|
+
import android.graphics.ColorFilter;
|
6
|
+
import android.graphics.Paint;
|
7
|
+
import android.graphics.Path;
|
8
|
+
import android.graphics.PixelFormat;
|
9
|
+
import android.graphics.Rect;
|
10
|
+
import android.graphics.drawable.Drawable;
|
11
|
+
|
12
|
+
public class CheckDrawable extends Drawable {
|
13
|
+
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
14
|
+
private Path mPath = new Path();
|
15
|
+
|
16
|
+
@Override
|
17
|
+
public void draw(Canvas canvas) {
|
18
|
+
mPaint.setColor(Color.parseColor("#40FF00"));
|
19
|
+
canvas.drawPath(mPath,mPaint);
|
20
|
+
}
|
21
|
+
|
22
|
+
@Override
|
23
|
+
public int getOpacity() {
|
24
|
+
return PixelFormat.TRANSLUCENT;
|
25
|
+
}
|
26
|
+
|
27
|
+
@Override
|
28
|
+
public void setAlpha(int alpha) {
|
29
|
+
mPaint.setAlpha(alpha);
|
30
|
+
}
|
31
|
+
|
32
|
+
@Override
|
33
|
+
public void setColorFilter(ColorFilter colorFilter) {
|
34
|
+
mPaint.setColorFilter(colorFilter);
|
35
|
+
}
|
36
|
+
|
37
|
+
@Override
|
38
|
+
protected void onBoundsChange(Rect bounds) {
|
39
|
+
super.onBoundsChange(bounds);
|
40
|
+
|
41
|
+
int width = bounds.width();
|
42
|
+
int height = bounds.height();
|
43
|
+
|
44
|
+
mPath.reset();
|
45
|
+
mPath.moveTo(0.375f * width, 0.67375f * height);
|
46
|
+
mPath.lineTo(0.20125f * width, 0.5f * height);
|
47
|
+
mPath.lineTo(0.142083333f * width, 0.55875f * height);
|
48
|
+
mPath.lineTo(0.375f * width, 0.791666667f * height);
|
49
|
+
mPath.lineTo(0.875f * width, 0.291666667f * height);
|
50
|
+
mPath.lineTo(0.81625f * width, 0.232916667f * height);
|
51
|
+
mPath.close();
|
52
|
+
}
|
53
|
+
}
|