rhodes 7.5.1 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +319 -0
  3. data/README.md +3 -15
  4. data/Rakefile +3 -0
  5. data/appveyor.yml +37 -32
  6. data/azure-pipelines.yml +1 -1
  7. data/bin/rhodes-setup +22 -8
  8. data/extensions/emdk3-manager/ext/platform/android/src/com/rho/emdk3/EMDK3Extension.java +14 -5
  9. data/extensions/instrumentation/ext/platform/android/src/com/rho/instrumentation/Instrumentation.java +29 -15
  10. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +1 -1
  11. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/ElementsCore.java +12 -9
  12. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/graphics/BatteryIndicator.java +2 -2
  13. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro +1 -1
  14. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro.erb +2 -2
  15. data/lib/commonAPI/barcode/ext/platform/qt/src/qzxing/QZXing.pri +9 -21
  16. data/lib/commonAPI/barcode/ext.yml +1 -0
  17. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro +1 -1
  18. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro.erb +1 -1
  19. data/lib/commonAPI/bluetooth/ext/platform/qt/src/bluetooth/bluetoothhelper.h +1 -1
  20. data/lib/commonAPI/coreapi/RhoSystemApi.rb +6 -0
  21. data/lib/commonAPI/coreapi/ext/Intent.xml +4 -0
  22. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/intent/IntentSingleton.java +6 -0
  23. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +2 -1
  24. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +1 -1
  25. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/webview/WebViewSingleton.java +40 -27
  26. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +5 -6
  27. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.h +1 -1
  28. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.m +3 -1
  29. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.h +2 -1
  30. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.m +10 -0
  31. data/lib/commonAPI/coreapi/ext/platform/wm/src/IntentImpl.cpp +3 -0
  32. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.cpp +13 -0
  33. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.h +2 -0
  34. data/lib/commonAPI/coreapi/ext/system.xml +3 -0
  35. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationCameraActivity.erb +2 -2
  36. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
  37. data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +1 -0
  38. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +8 -4
  39. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +8 -0
  40. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/mediacapture/RhoCameraFileProvider.java +6 -0
  41. data/lib/commonAPI/mediacapture/ext/platform/qt/MediaCapture.pro.erb +1 -1
  42. data/lib/commonAPI/mediacapture/ext/platform/qt/Mediacapture.pro +1 -1
  43. data/lib/commonAPI/signature/ext/platform/iphone/impl/readme.txt +7 -0
  44. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro +3 -10
  45. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro.erb +2 -2
  46. data/lib/extensions/fcm-push/ext/iphone/Podfile +15 -2
  47. data/lib/extensions/fcm-push/ext/iphone/fcm-push.xcodeproj/project.pbxproj +6 -7
  48. data/lib/extensions/nfc/ext/platform/android/src/com/rhomobile/nfc/Nfc.java +2 -1
  49. data/lib/extensions/serialport/ext/serialport.pro +1 -1
  50. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  51. data/platform/android/Rhodes/jni/src/fileapi.cpp +4 -0
  52. data/platform/android/Rhodes/res/drawable/baseline_check_24.xml +5 -0
  53. data/platform/android/Rhodes/res/drawable/baseline_check_240.xml +5 -0
  54. data/platform/android/Rhodes/res/drawable/baseline_close_24.xml +5 -0
  55. data/platform/android/Rhodes/res/drawable/baseline_close_240.xml +5 -0
  56. data/platform/android/Rhodes/res/layout/overlay_layout.xml +39 -0
  57. data/platform/android/Rhodes/res/layout/perrmission_alert_dialog.xml +267 -0
  58. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +183 -66
  59. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +38 -6
  60. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoFileProvider.java +32 -0
  61. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +529 -89
  62. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -4
  63. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +256 -160
  64. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +14 -3
  65. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +4 -0
  66. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +5 -4
  67. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +79 -38
  68. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +6 -1
  69. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/CallReceiver.java +22 -0
  70. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/IKioskMode.java +11 -0
  71. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/KioskManager.java +18 -0
  72. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java +230 -0
  73. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyNotificationListenerService.java +16 -0
  74. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyOverlayService.java +197 -0
  75. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/PermissionManager.java +232 -0
  76. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +34 -8
  77. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/CheckDrawable.java +53 -0
  78. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/PermissionListGenerate.java +366 -0
  79. data/platform/android/Rhodes/src/com/rhomobile/rhodes/rhodes.iml +11 -0
  80. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +1 -0
  81. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +782 -41
  82. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputConnectionWrapper.java +146 -0
  83. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputListener.java +21 -0
  84. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +92 -32
  85. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/TauWebViewOptions.java +118 -0
  86. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderBase.java +18 -17
  87. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderEclairMR1.java +4 -4
  88. data/platform/android/build/RhodesSRC_build.files +13 -0
  89. data/platform/android/build/android-repack.rake +8 -1
  90. data/platform/android/build/android.rake +118 -51
  91. data/platform/android/build/android_tools.rb +1 -1
  92. data/platform/android/build/androidcommon.rb +13 -7
  93. data/platform/android/build/config.yml +4 -1
  94. data/platform/android/build/manifest_generator.rb +14 -10
  95. data/platform/android/build/maven_deps_extractor.rb +7 -1
  96. data/platform/android/build/ndkwrapper.rb +12 -0
  97. data/platform/android/proguard/proguard-base-rules.pro +5 -0
  98. data/platform/android/proguard/proguard.jar +0 -0
  99. data/platform/iphone/Classes/RhoAppBaseLib-Bridging-Header.h +4 -0
  100. data/platform/iphone/Classes/RhoAppBaseStandaloneLib-Bridging-Header.h +4 -0
  101. data/platform/iphone/Classes/RhoCryptAESGCM.swift +105 -0
  102. data/platform/iphone/Classes/RhoUIWebView.h +1 -1
  103. data/platform/iphone/Classes/RhoUIWebView.m +1 -1
  104. data/platform/iphone/Classes/RhoWKWebView.h +1 -1
  105. data/platform/iphone/Classes/RhoWKWebView.mm +32 -4
  106. data/platform/iphone/Classes/RhoWebView.h +1 -1
  107. data/platform/iphone/Classes/RhoWebViewFabrique.m +7 -1
  108. data/platform/iphone/Classes/SimpleMainView.m +5 -5
  109. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -10
  110. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -0
  111. data/platform/iphone/Framework/RhoApplication/RhoApplication.xcodeproj/project.pbxproj +1 -1
  112. data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1 -1
  113. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +46 -1
  114. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +1 -1
  115. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -1
  116. data/platform/iphone/rbuild/iphone.rake +9 -8
  117. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
  118. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +1 -1
  119. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +1 -1
  120. data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
  121. data/platform/sailfish/build/{harbour-SailfishRhodes.pro.erb → SailfishRhodes.pro.erb} +10 -17
  122. data/platform/sailfish/build/rhodes.pro.erb +7 -17
  123. data/platform/sailfish/build/rpm/SailfishRhodes.desktop.erb +12 -0
  124. data/platform/sailfish/build/rpm/SailfishRhodes.erb +2 -0
  125. data/platform/sailfish/build/rpm/SailfishRhodes.spec.erb +43 -0
  126. data/platform/sailfish/build/rubylib.pro.erb +29 -29
  127. data/platform/sailfish/build/sailfish.rake +188 -180
  128. data/platform/sailfish/keys/regular_cert.pem +14 -0
  129. data/platform/sailfish/keys/regular_key.pem +4 -0
  130. data/platform/shared/common/RhodesApp.cpp +33 -9
  131. data/platform/shared/common/iphone/RhoCryptImpl.mm +130 -54
  132. data/platform/shared/qt/RhoSimulator.pro +1 -1
  133. data/platform/shared/qt/rhodes/rhodes.pro +4 -11
  134. data/platform/shared/qt/sailfish/SailfishRhodes.desktop +3 -4
  135. data/platform/shared/qt/sailfish/SailfishRhodes.pro +9 -10
  136. data/platform/shared/qt/sailfish/icons/108x108/108x108.png +0 -0
  137. data/platform/shared/qt/sailfish/privileges/sailfishrhodes +2 -0
  138. data/platform/shared/qt/sailfish/qml/pages/FirstPageWK.qml +7 -11
  139. data/platform/shared/qt/sailfish/qml/{harbour-sailfishrhodes.qml → sailfishrhodes.qml} +1 -1
  140. data/platform/shared/qt/sailfish/rpm/sailfishrhodes.spec +80 -0
  141. data/platform/shared/qt/sailfish/rpm/{harbour-sailfishrhodes.yaml → sailfishrhodes.yaml} +2 -2
  142. data/platform/shared/qt/sailfish/src/QtMainWindow.cpp +1 -1
  143. data/platform/shared/qt/sailfish/src/QtMainWindow.h +1 -1
  144. data/platform/shared/qt/sailfish/src/main.cpp +6 -38
  145. data/platform/shared/qt/sailfish/src/rootdelegate.h +2 -14
  146. data/platform/shared/ruby/aurora/ruby/config.h +386 -0
  147. data/platform/shared/ruby/aurora/ruby/constdefs.c +5866 -0
  148. data/platform/shared/ruby/aurora/ruby/constdefs.h +1788 -0
  149. data/platform/shared/sqlite/crypto.c +14 -0
  150. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  151. data/platform/win32/build/rhodes.nsi +3 -3
  152. data/platform/win32/build/win32.rake +1 -1
  153. data/rakefile.rb +3 -0
  154. data/res/build-tools/iphonesim/build/Release/iphonesim_8 +4 -4
  155. data/res/generators/templates/application/AndroidManifest.erb +26 -5
  156. data/res/generators/templates/application/build.yml +14 -10
  157. data/res/generators/templates/application/resources/android/res/xml/provider_paths.xml +4 -0
  158. data/res/generators/templates/application/rhoconfig.txt +10 -1
  159. data/res/generators/templates/iphone_project/Bremen8.xcodeproj/project.pbxproj +24 -1
  160. data/res/generators/templates/iphone_project/Classes/SimpleSwiftClass.swift +20 -0
  161. data/res/generators/templates/iphone_project/Classes/rhorunner-Bridging-Header.h +4 -0
  162. data/rhobuild.yml.example +3 -3
  163. data/rhodes.gemspec +4 -2
  164. data/version +1 -1
  165. metadata +81 -26
  166. data/platform/sailfish/build/rho_build.cmd.erb +0 -14
  167. data/platform/sailfish/build/rho_clean.cmd.erb +0 -14
  168. data/platform/sailfish/build/rho_deploy.cmd.erb +0 -15
  169. data/platform/sailfish/build/rho_rpm.cmd.erb +0 -14
  170. data/platform/sailfish/build/rho_rpmvalidation.cmd.erb +0 -14
  171. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.desktop.erb +0 -7
  172. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.erb +0 -2
  173. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.yaml.erb +0 -37
  174. data/platform/shared/qt/sailfish/harbour-sailfishrhodes.desktop +0 -6
  175. data/platform/shared/qt/sailfish/icons/108x108/harbour-sailfishrhodes.png +0 -0
  176. data/platform/shared/qt/sailfish/privileges/harbour-sailfishrhodes +0 -2
  177. data/platform/shared/qt/sailfish/qml/pages/FirstPageWE.qml +0 -236
  178. /data/platform/shared/qt/sailfish/icons/128x128/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  179. /data/platform/shared/qt/sailfish/icons/172x172/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  180. /data/platform/shared/qt/sailfish/icons/86x86/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
@@ -1,18 +1,18 @@
1
1
  /*------------------------------------------------------------------------
2
2
  * (The MIT License)
3
- *
3
+ *
4
4
  * Copyright (c) 2008-2011 Rhomobile, Inc.
5
- *
5
+ *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
8
8
  * in the Software without restriction, including without limitation the rights
9
9
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
10
  * copies of the Software, and to permit persons to whom the Software is
11
11
  * furnished to do so, subject to the following conditions:
12
- *
12
+ *
13
13
  * The above copyright notice and this permission notice shall be included in
14
14
  * all copies or substantial portions of the Software.
15
- *
15
+ *
16
16
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
17
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
18
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -20,7 +20,7 @@
20
20
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  * THE SOFTWARE.
23
- *
23
+ *
24
24
  * http://rhomobile.com
25
25
  *------------------------------------------------------------------------*/
26
26
 
@@ -38,11 +38,24 @@ import java.io.InputStream;
38
38
  import com.rhomobile.rhodes.extmanager.IRhoExtManager;
39
39
  import com.rhomobile.rhodes.extmanager.IRhoWebView;
40
40
  import com.rhomobile.rhodes.extmanager.RhoExtManager;
41
+ import com.rhomobile.rhodes.kioskservices.IKioskMode;
42
+ import com.rhomobile.rhodes.kioskservices.KioskManager;
43
+ import com.rhomobile.rhodes.kioskservices.PermissionManager;
41
44
  import com.rhomobile.rhodes.mainview.MainView;
42
45
  import com.rhomobile.rhodes.mainview.SimpleMainView;
43
46
  import com.rhomobile.rhodes.mainview.SplashScreen;
44
47
  import com.rhomobile.rhodes.util.Config;
45
48
  import com.rhomobile.rhodes.util.Utils;
49
+ import com.rhomobile.rhodes.kioskservices.MyOverlayService;
50
+ import com.rhomobile.rhodes.util.PerformOnUiThread;
51
+
52
+
53
+ import android.os.Build;
54
+ import android.Manifest;
55
+ import android.provider.Settings;
56
+ import android.os.Environment;
57
+
58
+
46
59
 
47
60
  import android.app.Dialog;
48
61
  import android.content.ComponentName;
@@ -69,77 +82,148 @@ import android.view.ViewTreeObserver;
69
82
  import android.view.Window;
70
83
  import android.widget.FrameLayout;
71
84
  import android.util.Log;
85
+ import android.widget.Button;
86
+ import android.app.AlertDialog;
87
+ import android.widget.LinearLayout;
88
+ import android.widget.ImageView;
89
+
90
+ import java.util.Vector;
91
+
92
+ import android.widget.Toast;
72
93
 
73
94
  import androidx.core.content.PermissionChecker;
74
95
  import androidx.core.app.ActivityCompat;
96
+ import android.app.Activity;
97
+ import android.content.DialogInterface;
98
+ import com.rhomobile.rhodes.webview.RhoInputListener;
99
+ import com.rhomobile.rhodes.webview.RhoInputListener.IRhoInputListener;
100
+
101
+
102
+ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashScreenListener, ActivityCompat.OnRequestPermissionsResultCallback, IKioskMode {
75
103
 
76
- public class RhodesActivity extends BaseActivity implements SplashScreen.SplashScreenListener, ActivityCompat.OnRequestPermissionsResultCallback {
77
-
78
104
  private static final String TAG = RhodesActivity.class.getSimpleName();
79
-
105
+
80
106
  private static final boolean DEBUG = false;
81
-
107
+
82
108
  public static boolean IS_WINDOWS_KEY = false;
83
-
109
+
84
110
  public static boolean isShownSplashScreenFirstTime = false;//Used to display the splash screen only once during launch of an application
85
-
111
+
86
112
  public static int MAX_PROGRESS = 10000;
87
-
113
+
88
114
  private static RhodesActivity sInstance = null;
89
-
115
+
90
116
  private Handler mHandler;
91
-
117
+
92
118
  private View mChild;
93
119
  private int oldHeight;
94
120
  private FrameLayout.LayoutParams frameLayoutParams;
95
121
  private int notificationBarHeight = 0;
96
122
  public static boolean IS_RESIZE_SIP = false;
97
-
98
- private FrameLayout mTopLayout;
123
+
124
+ public FrameLayout mTopLayout;
99
125
  private SplashScreen mSplashScreen;
100
- private MainView mMainView;
126
+ private MainView mMainView = null;
127
+ private static MainView mWebMainView = null;
101
128
  private String lastIntent ="android.intent.action.MAIN";
102
129
  private RhoMenu mAppMenu;
103
130
 
104
131
  private long uiThreadId = 0;
105
132
  public static SharedPreferences pref = null;
106
-
133
+
134
+ private static boolean permissionWindowShow = false;
135
+ private AlertDialog mPermissionsDialog = null;
136
+ private static boolean mIsUseOverlay = false;
137
+
138
+
139
+ private class AdditionalContentView {
140
+ public View view = null;
141
+ public ViewGroup.LayoutParams lparams = null;
142
+ public AdditionalContentView() {
143
+ view = null;
144
+ lparams = null;
145
+ }
146
+ }
147
+
148
+
149
+ private static Vector<AdditionalContentView> ourAdditionalContentViews = new Vector<AdditionalContentView>(1);
150
+
151
+ @Override
152
+ public void addContentView (View view,
153
+ ViewGroup.LayoutParams params) {
154
+ AdditionalContentView item = new AdditionalContentView();
155
+ item.view = view;
156
+ item.lparams = params;
157
+ if (!(view instanceof SimpleMainView.MyView)) {
158
+ //ourAdditionalContentViews.addElement(item);
159
+ }
160
+ super.addContentView(view, params);
161
+ }
162
+
163
+
164
+ public void addContentViewInner (View view,
165
+ ViewGroup.LayoutParams params) {
166
+ AdditionalContentView item = new AdditionalContentView();
167
+ item.view = view;
168
+ item.lparams = params;
169
+ if (!(view instanceof SimpleMainView.MyView)) {
170
+ ourAdditionalContentViews.addElement(item);
171
+ }
172
+ super.addContentView(view, params);
173
+ }
174
+
175
+
176
+ public static FrameLayout onOverlayStarted(FrameLayout overlayLayout) {
177
+ for(int i=0; i < ourAdditionalContentViews.size(); ++i) {
178
+ AdditionalContentView item = ourAdditionalContentViews.get(i);
179
+ ViewGroup vg = (ViewGroup) item.view.getParent();
180
+ if (vg != null) {
181
+ vg.removeView(item.view);
182
+ }
183
+ overlayLayout.addView(item.view, item.lparams);
184
+ }
185
+ return overlayLayout;
186
+ }
187
+
188
+
107
189
  public static interface GestureListener {
108
190
  void onTripleTap();
109
191
  void onQuadroTap();
110
192
  };
111
-
193
+
194
+
195
+
112
196
  public static class GestureListenerAdapter implements GestureListener {
113
197
  public void onTripleTap() {
114
-
198
+
115
199
  }
116
-
200
+
117
201
  public void onQuadroTap() {
118
-
202
+
119
203
  }
120
204
  };
121
-
205
+
122
206
  private static ArrayList<GestureListener> ourGestureListeners = new ArrayList<GestureListener>();
123
207
 
124
-
208
+
125
209
  public long getUiThreadId() {
126
210
  return uiThreadId;
127
211
  }
128
-
212
+
129
213
  private boolean mIsForeground = false;
130
214
  private boolean mIsInsideStartStop = false;
131
-
215
+
132
216
  public boolean isForegroundNow() {
133
217
  return mIsForeground;
134
218
  }
135
-
219
+
136
220
  public boolean isInsideStartStop() {
137
221
  return mIsInsideStartStop;
138
222
  }
139
-
223
+
140
224
  //------------------------------------------------------------------------------------------------------------------
141
225
  // Read SSL settings from config.xml
142
-
226
+
143
227
  private ApplicationInfo getAppInfo() {
144
228
  String pkgName = getPackageName();
145
229
  try {
@@ -168,7 +252,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
168
252
  configIs = getResources().openRawResource(RhoExtManager.getResourceId("raw", "config"));
169
253
  config.load(configIs, externalSharedPath);
170
254
  }
171
-
255
+
172
256
  String isWindowKey = null;
173
257
  try {
174
258
  isWindowKey = config.getValue("isWindowsKey");
@@ -179,7 +263,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
179
263
  if(isWindowKey.contains("1")){
180
264
  IS_WINDOWS_KEY = true;
181
265
  }
182
- }
266
+ }
183
267
 
184
268
  String CAFile = config.getValue("CAFile");
185
269
  if (CAFile != null && CAFile.length() > 0)
@@ -193,7 +277,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
193
277
  if (sVerifyPeer != null && sVerifyPeer.length() > 0)
194
278
  RhoConf.setBoolean("no_ssl_verify_peer", sVerifyPeer.equals("0"));
195
279
 
196
-
280
+
197
281
  String pageZoom=config.getValue("PageZoom");
198
282
  if(pageZoom !=null && pageZoom.length()>0)
199
283
  RhoConf.setString("PageZoom", pageZoom);
@@ -211,11 +295,11 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
211
295
  }else{
212
296
  RhoConf.setBoolean("full_screen", false);
213
297
  }
214
- }
215
-
216
-
217
-
218
-
298
+ }
299
+
300
+
301
+
302
+
219
303
  } catch (Throwable e) {
220
304
  Logger.W(TAG, "Error loading RhoElements configuraiton ("+e.getClass().getSimpleName()+"): " + e.getMessage());
221
305
  //Logger.W(TAG, e);
@@ -235,20 +319,20 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
235
319
  String configPath = new File(externalSharedPath, "Config.xml").getAbsolutePath();
236
320
  initConfig(configPath);
237
321
  }
238
-
322
+
239
323
  //------------------------------------------------------------------------------------------------------------------
240
324
 
241
325
  private final int RHODES_PERMISSIONS_REQUEST = 1;
242
326
 
243
327
  private void requestPermissions() {
244
328
  String pkgName = getPackageName();
245
-
329
+
246
330
  try {
247
331
  PackageInfo info = getPackageManager().getPackageInfo(pkgName, PackageManager.GET_PERMISSIONS);
248
332
 
249
333
  ArrayList<String> requestedPermissions = new ArrayList<String>();
250
334
 
251
- for ( String p : info.requestedPermissions ) {
335
+ for ( String p : info.requestedPermissions ) {
252
336
 
253
337
  int result = PermissionChecker.checkSelfPermission( this, p );
254
338
 
@@ -258,6 +342,23 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
258
342
  }
259
343
 
260
344
  if ( requestedPermissions.size() > 0 ) {
345
+ for (String p : requestedPermissions){
346
+ if (p.contains("MANAGE_EXTERNAL_STORAGE") &&
347
+ Build.VERSION.SDK_INT >= 30){
348
+ if (!Environment.isExternalStorageManager()){
349
+ try{
350
+ Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
351
+ intent.addCategory("android.intent.category.DEFAULT");
352
+ intent.setData(Uri.parse(String.format("package:%s", this.getPackageName())));
353
+ this.startActivityForResult(intent, RHODES_PERMISSIONS_REQUEST);
354
+ } catch (Exception e) {
355
+ Intent intent = new Intent();
356
+ intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
357
+ this.startActivityForResult(intent, RHODES_PERMISSIONS_REQUEST);
358
+ }
359
+ }
360
+ }
361
+ }
261
362
  Logger.I(TAG, "Requesting permissions: " + requestedPermissions.toString() );
262
363
 
263
364
  ActivityCompat.requestPermissions(
@@ -271,7 +372,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
271
372
  }
272
373
 
273
374
  @Override
274
- public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
375
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
275
376
 
276
377
  StringBuilder results = new StringBuilder();
277
378
 
@@ -282,17 +383,17 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
282
383
  Logger.I(
283
384
  TAG,
284
385
  String.format(
285
- "onRequestPermissionsResult code: %d, results: %s",
286
- requestCode,
386
+ "onRequestPermissionsResult code: %d, results: %s",
387
+ requestCode,
287
388
  results.toString()
288
389
  )
289
390
  );
290
391
  }
291
-
392
+
292
393
  @Override
293
394
  protected void onCreate(Bundle savedInstanceState) {
294
395
  Logger.T(TAG, "onCreate");
295
-
396
+
296
397
  Thread ct = Thread.currentThread();
297
398
  //ct.setPriority(Thread.MAX_PRIORITY);
298
399
  uiThreadId = ct.getId();
@@ -313,20 +414,35 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
313
414
  mHandler = new Handler();
314
415
 
315
416
  Logger.T(TAG, "Creating default main view");
316
-
417
+
317
418
  mTopLayout = new FrameLayout(this);
318
419
  setContentView(mTopLayout);
319
420
 
320
- SimpleMainView simpleMainView = new SimpleMainView();
321
- setMainView(simpleMainView);
322
-
421
+
422
+ if (mWebMainView != null) {
423
+ ViewGroup vg = (ViewGroup) mWebMainView.getView().getParent();
424
+ if (vg != null) {
425
+ vg.removeView(mWebMainView.getView());
426
+ }
427
+ setMainView(mWebMainView);
428
+ isShownSplashScreenFirstTime = true;
429
+ notifyUiCreated();
430
+ }
431
+ else {
432
+ SimpleMainView simpleMainView = new SimpleMainView();
433
+ setMainView(simpleMainView);
434
+
435
+ readRhoElementsConfig();
436
+ RhoExtManager.getImplementationInstance().onCreateActivity(this, getIntent());
437
+
438
+ RhodesApplication.stateChanged(RhodesApplication.UiState.MainActivityCreated);
439
+
440
+ }
441
+
442
+
323
443
  mAppMenu = new RhoMenu();
324
444
 
325
- readRhoElementsConfig();
326
- RhoExtManager.getImplementationInstance().onCreateActivity(this, getIntent());
327
445
 
328
- RhodesApplication.stateChanged(RhodesApplication.UiState.MainActivityCreated);
329
-
330
446
  if (RhoConf.isExist("resize_sip")) {
331
447
  String resizeSIP = RhoConf.getString("resize_sip");
332
448
  if (resizeSIP != null && resizeSIP.contains("1")) {
@@ -340,6 +456,12 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
340
456
  requestPermissions();
341
457
  }
342
458
 
459
+
460
+ public View getContentView() {
461
+ return mTopLayout;
462
+ }
463
+
464
+
343
465
  public MainView switchToSimpleMainView(MainView currentView) {
344
466
  IRhoWebView rhoWebView = currentView.detachWebView();
345
467
  SimpleMainView view = new SimpleMainView(rhoWebView);
@@ -347,7 +469,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
347
469
  setMainView(view);
348
470
  return view;
349
471
  }
350
-
472
+
351
473
  public void notifyUiCreated() {
352
474
  RhodesService r = RhodesService.getInstance();
353
475
  if ( r != null ) {
@@ -363,13 +485,13 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
363
485
  mHandler.postDelayed(this, 100);
364
486
  return;
365
487
  }
366
-
488
+
367
489
  RhodesService.callUiCreatedCallback();
368
490
  }
369
491
  });
370
492
  }
371
493
  }
372
-
494
+
373
495
  @Override
374
496
  protected void onNewIntent(Intent intent) {
375
497
  super.onNewIntent(intent);
@@ -386,7 +508,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
386
508
  }
387
509
  }
388
510
  else if((intent.getAction().compareTo("android.intent.action.MAIN") == 0) && (!(lastIntent.compareTo("com.rho.rhoelements.SHORTCUT_ACTION") == 0)) && (RhoExtManager.getInstance().getWebView().getUrl()!=null/*..Double CLick Crash...*/) ){
389
- //This Else is to handle start page when user call two times on minimize API
511
+ //This Else is to handle start page when user call two times on minimize API
390
512
  //That time last intent will be as VIEW and intent action will be MAIN
391
513
  String url = RhoExtManager.getInstance().getWebView().getUrl().toString();
392
514
  intent.setAction("android.intent.action.VIEW");
@@ -399,12 +521,12 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
399
521
  intent.setAction("android.intent.action.VIEW");
400
522
  intent.setData(Uri.parse(url));
401
523
  }
402
- handleStartParams(intent);
524
+ handleStartParams(intent, false);
403
525
 
404
526
  RhoExtManager.getImplementationInstance().onNewIntent(this, intent);
405
527
  lastIntent = intent.getAction();
406
528
  }
407
-
529
+
408
530
  @Override
409
531
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
410
532
  super.onActivityResult(requestCode, resultCode, data);
@@ -450,14 +572,18 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
450
572
  @Override
451
573
  public void onResume() {
452
574
  Logger.T(TAG, "onResume");
453
-
575
+
576
+ if(permissionWindowShow) {
577
+ startKioskMode(mIsUseOverlay);
578
+ }
579
+
454
580
  if(!isShownSplashScreenFirstTime){
455
581
  Logger.T(TAG, "Creating splash screen");
456
582
  mSplashScreen = new SplashScreen(this, mMainView, this);
457
583
  mMainView = mSplashScreen;
458
584
  isShownSplashScreenFirstTime = true;
459
585
  }
460
-
586
+
461
587
  mIsForeground = true;
462
588
  pauseWebViews(false);
463
589
  super.onResume();
@@ -467,7 +593,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
467
593
  }
468
594
 
469
595
  @Override
470
- public void onPause()
596
+ public void onPause()
471
597
  {
472
598
  mIsForeground = false;
473
599
  pauseWebViews(true);
@@ -505,29 +631,31 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
505
631
  }
506
632
 
507
633
  @Override
508
- public void onStop()
634
+ public void onStop()
509
635
  {
510
636
  super.onStop();
511
637
  Logger.T(TAG, "onStop");
512
638
 
513
- RhoExtManager.getImplementationInstance().onStopActivity(this);
639
+ //RhoExtManager.getImplementationInstance().onStopActivity(this);
514
640
 
515
641
  mIsInsideStartStop = false;
642
+ // RhoExtManager.getInstance().quitApp();
643
+ //RhodesService.PerformRealExitInUiThread();
516
644
  }
517
645
 
518
646
  @Override
519
647
  public void onDestroy() {
520
648
  Logger.T(TAG, "onDestroy");
521
649
 
522
- RhoExtManager.getImplementationInstance().onDestroyActivity(this);
650
+ //RhoExtManager.getImplementationInstance().onDestroyActivity(this);
523
651
 
524
- RhodesApplication.stateChanged(RhodesApplication.UiState.Undefined);
652
+ //RhodesApplication.stateChanged(RhodesApplication.UiState.Undefined);
525
653
 
526
654
  sInstance = null;
527
655
 
528
656
  super.onDestroy();
529
657
  }
530
-
658
+
531
659
  @Override
532
660
  public boolean onKeyDown(int keyCode, KeyEvent event) {
533
661
  switch (keyCode) {
@@ -537,7 +665,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
537
665
  Logger.D(TAG, "onKeyDown: r=" + r);
538
666
  if (r == null)
539
667
  return false;
540
-
668
+
541
669
  // If the RhoConf setting of disable_back_button is set to 1, pretend we did something.
542
670
  if (RhoConf.isExist("disable_back_button") && RhoConf.getInt("disable_back_button") == 1) {
543
671
  Logger.D(TAG, "Back button pressed, but back button is disabled in RhoConfig.");
@@ -548,7 +676,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
548
676
  return true;
549
677
  }
550
678
  }
551
-
679
+
552
680
  return super.onKeyDown(keyCode, event);
553
681
  }
554
682
 
@@ -559,17 +687,17 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
559
687
  @Override
560
688
  public boolean onCreateOptionsMenu(Menu menu) {
561
689
  super.onCreateOptionsMenu(menu);
562
-
690
+
563
691
  mAppMenu.enumerateMenu(menu);
564
692
  Logger.T(TAG, "onCreateOptionsMenu");
565
-
693
+
566
694
  return mAppMenu.getItemsCount() != 0;
567
695
  }
568
-
696
+
569
697
  @Override
570
698
  public boolean onPrepareOptionsMenu(Menu menu) {
571
699
  super.onPrepareOptionsMenu(menu);
572
-
700
+
573
701
  Logger.T(TAG, "onPrepareOptionsMenu");
574
702
 
575
703
  mAppMenu.enumerateMenu(menu);
@@ -627,15 +755,15 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
627
755
  public RhodesService getService() {
628
756
  return mRhodesService;
629
757
  }
630
-
758
+
631
759
  public void post(Runnable r) {
632
760
  mHandler.post(r);
633
761
  }
634
-
762
+
635
763
  public void post(Runnable r, long delay) {
636
764
  mHandler.postDelayed(r, delay);
637
765
  }
638
-
766
+
639
767
  public SplashScreen getRhodesSplashScreen() {
640
768
  return mSplashScreen;
641
769
  }
@@ -645,12 +773,42 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
645
773
  mTopLayout.removeAllViews();
646
774
  mMainView = v;
647
775
  mTopLayout.addView(v.getView(), new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
776
+ if (v instanceof SimpleMainView) {
777
+ mWebMainView = v;
778
+ }
779
+
780
+ for(int i=0; i < ourAdditionalContentViews.size(); ++i) {
781
+ AdditionalContentView item = ourAdditionalContentViews.get(i);
782
+ ViewGroup vg = (ViewGroup) item.view.getParent();
783
+ if (vg != null) {
784
+ vg.removeView(item.view);
785
+ }
786
+ super.addContentView(item.view, item.lparams);
787
+ }
648
788
  }
649
789
  }
650
790
 
651
791
  public MainView getMainView() {
652
792
  return mMainView;
653
- }
793
+ }
794
+
795
+ public static MainView extractMainView() {
796
+ RhodesActivity ins = sInstance;
797
+ if (ins != null) {
798
+ if (ins.getMainView() instanceof SimpleMainView) {
799
+ mWebMainView = ins.getMainView();
800
+ }
801
+ ins.mTopLayout.removeAllViews();
802
+ }
803
+ return mWebMainView;
804
+ }
805
+
806
+ private static Runnable ourRestartActivityCallback = null;
807
+
808
+ public static void setRestartActivityCallback(Runnable r) {
809
+ ourRestartActivityCallback = r;
810
+ }
811
+
654
812
 
655
813
  @Override
656
814
  public void onServiceConnected(ComponentName name, IBinder service) {
@@ -658,23 +816,32 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
658
816
 
659
817
  Logger.D(TAG, "onServiceConnected: " + name.toShortString());
660
818
 
661
- handleStartParams(getIntent());
819
+ handleStartParams(getIntent(), true);
820
+
821
+ if(mIsServiceAllreadyExist)
822
+ {
823
+ if (ourRestartActivityCallback != null) {
824
+ ourRestartActivityCallback.run();
825
+ }
826
+ onActivityStarted(this);
827
+ getMainView().navigate(RhodesService.currentLocation(-1), -1);
828
+ }
662
829
  }
663
830
 
664
- private void handleStartParams(Intent intent)
831
+ private void handleStartParams(Intent intent, boolean writeStartParam)
665
832
  {
666
833
  StringBuilder startParams = new StringBuilder();
667
834
  boolean firstParam = true;
668
835
  if (intent.getData() != null) {
669
836
  String strUri = intent.toUri(0);
670
-
837
+
671
838
  if(strUri.length() > 0)
672
839
  {
673
840
  Uri uri = Uri.parse(strUri);
674
841
  String authority = uri.getAuthority();
675
842
  String path = uri.getPath();
676
843
  String query = uri.getQuery();
677
-
844
+
678
845
  if (authority != null)
679
846
  startParams.append(authority);
680
847
  if (path != null)
@@ -688,7 +855,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
688
855
  Bundle extras = intent.getExtras();
689
856
  if (extras != null) {
690
857
  Set<String> keys = extras.keySet();
691
-
858
+
692
859
  for (String key : keys) {
693
860
  Object value = extras.get(key);
694
861
  if (firstParam) {
@@ -705,10 +872,13 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
705
872
  }
706
873
  String paramString = startParams.toString();
707
874
  Logger.I(TAG, "New start parameters: " + paramString);
875
+ if (writeStartParam){
876
+ RhodesApplication.setStartParametersApp(paramString);
877
+ }
708
878
  if(!RhodesApplication.canStart(paramString))
709
879
  {
710
880
  Logger.E(TAG, "This is hidden app and can be started only with security key.");
711
-
881
+
712
882
  //Toast.makeText(this,"Invalid security token !",Toast.LENGTH_SHORT).show();
713
883
  /*
714
884
  AlertDialog.Builder b = new AlertDialog.Builder(this);
@@ -724,7 +894,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
724
894
  public void onClick(DialogInterface arg0, int arg1) {
725
895
  RhodesService.exit();
726
896
  }
727
-
897
+
728
898
  });
729
899
  securityAlert.show();
730
900
  */
@@ -733,7 +903,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
733
903
 
734
904
 
735
905
  // String urlStart = uri.getPath();
736
- // if (urlStart != null) {
906
+ // if (urlStart != null) {
737
907
  // if ("".compareTo(urlStart) != 0)
738
908
  // {
739
909
  // Logger.D(TAG, "PROCESS URL START: " + urlStart);
@@ -741,7 +911,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
741
911
  // }
742
912
  // }
743
913
  }
744
-
914
+
745
915
  @Override
746
916
  public boolean dispatchKeyEvent(KeyEvent event)
747
917
  {
@@ -787,11 +957,11 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
787
957
  pref.getString("scandecodewavkey", "");
788
958
  return decodeWavPath;
789
959
  }
790
-
960
+
791
961
  public static void setDecodeWav(String string){
792
962
  pref.edit().putString("scandecodewavkey", string).commit();
793
963
  }
794
-
964
+
795
965
  public void resizeSIP() {
796
966
  FrameLayout mLayout = (FrameLayout) this
797
967
  .findViewById(android.R.id.content);
@@ -801,6 +971,13 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
801
971
  new ViewTreeObserver.OnGlobalLayoutListener() {
802
972
  public void onGlobalLayout() {
803
973
  resizeChildOfContent();
974
+
975
+ Rect r = new Rect();
976
+ //r will be populated with the coordinates of your view that area still visible.
977
+ mChild.getWindowVisibleDisplayFrame(r);
978
+
979
+ RhoExtManager.getInstance().onInputMethod( mChild, false, "", r);
980
+
804
981
  }
805
982
  });
806
983
  frameLayoutParams = (FrameLayout.LayoutParams) mChild.getLayoutParams();
@@ -819,7 +996,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
819
996
  // keyboard probably just became hidden
820
997
  frameLayoutParams.height = sipHeight;
821
998
  }
822
- if( !BaseActivity.getFullScreenMode()){
999
+ if( !BaseActivity.getFullScreenMode()){
823
1000
  frameLayoutParams.height = frameLayoutParams.height - notificationBarHeight;
824
1001
  if (heightDiff > (sipHeight / 4)) {
825
1002
  frameLayoutParams.height = frameLayoutParams.height + notificationBarHeight;
@@ -837,4 +1014,267 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
837
1014
  return (r.bottom - r.top);
838
1015
  }
839
1016
 
1017
+ @Override
1018
+ public void startKioskMode(boolean use_overlay) {
1019
+ mIsUseOverlay = use_overlay;
1020
+ Activity mActivity= (Activity) this;
1021
+ Context mContext = getApplicationContext();
1022
+ //if (!KioskManager.getKioskModeStatus()) {
1023
+ if(PermissionManager.checkPermissions(mContext, mActivity)){
1024
+ //Toast.makeText(mContext, "Kiosk mode started", Toast.LENGTH_SHORT).show();
1025
+ if(permissionWindowShow) permissionWindowShow = false;
1026
+ if (mPermissionsDialog != null) {
1027
+ try {
1028
+ mPermissionsDialog.dismiss();
1029
+ }
1030
+ catch(Exception ex) {
1031
+
1032
+ }
1033
+ mPermissionsDialog = null;
1034
+ }
1035
+ KioskManager.setKioskMode(true);
1036
+ if (mIsUseOverlay) {
1037
+ PerformOnUiThread.exec(new Runnable() {
1038
+ @Override
1039
+ public void run() {
1040
+ startOverlay();
1041
+ }
1042
+ }, 500);
1043
+
1044
+ }
1045
+ }
1046
+ else{
1047
+ permissionWindowShow = true;
1048
+ showAlertPermission();
1049
+ }
1050
+ //}
1051
+ }
1052
+
1053
+ @Override
1054
+ public void stopKioskMode() {
1055
+ if (KioskManager.getKioskModeStatus()) {
1056
+ KioskManager.setKioskMode(false);
1057
+
1058
+ Context mContext = getApplicationContext();
1059
+ Toast.makeText(mContext, "Kiosk mode finished", Toast.LENGTH_SHORT).show();
1060
+ if (mIsUseOverlay) {
1061
+ stopOverlay();
1062
+ }
1063
+
1064
+ //PermissionManager.setDefaultLauncher(this);
1065
+ }
1066
+ }
1067
+
1068
+ @Override
1069
+ public boolean isKioskMode() {
1070
+ return KioskManager.getKioskModeStatus();
1071
+ }
1072
+
1073
+ @Override
1074
+ public void startOverlay() {
1075
+ Activity mActivity= (Activity) this;
1076
+ Context mContext = getApplicationContext();
1077
+ if(PermissionManager.checkOverlayPermission(mContext)){
1078
+ Intent overlay = new Intent(this, MyOverlayService.class);
1079
+ startService(overlay);
1080
+ }
1081
+ else
1082
+ PermissionManager.setOverlayPermission(mActivity);
1083
+ }
1084
+
1085
+ @Override
1086
+ public void stopOverlay() {
1087
+ // TODO Auto-generated method stub
1088
+ MyOverlayService os = MyOverlayService.getInstance();
1089
+ if (os != null) {
1090
+ if (MyOverlayService.isOverlayMode()) {
1091
+ os.stopOverlayMode();
1092
+ }
1093
+ }
1094
+ //throw new UnsupportedOperationException("Unimplemented method 'stopOverlay'");
1095
+ }
1096
+
1097
+ @Override
1098
+ public boolean isAllPermissions() {
1099
+ Activity mActivity= (Activity) this;
1100
+ Context mContext = getApplicationContext();
1101
+ boolean perm = PermissionManager.checkPermissions(mContext, mActivity);
1102
+ //Toast.makeText(mActivity, "Permission: "+ (perm? "true" : "flase"),Toast.LENGTH_LONG).show();
1103
+ return PermissionManager.checkPermissions(mContext, mActivity);
1104
+ }
1105
+
1106
+ @Override
1107
+ public void showPermissionsList() {
1108
+ showAlertPermission();
1109
+ }
1110
+
1111
+ private Activity mActivity = null;
1112
+
1113
+ private void showAlertPermission() {
1114
+ mActivity= (Activity) this;
1115
+
1116
+ if (mPermissionsDialog != null) {
1117
+ try {
1118
+ mPermissionsDialog.dismiss();
1119
+ }
1120
+ catch(Exception ex) {
1121
+
1122
+ }
1123
+ mPermissionsDialog = null;
1124
+ }
1125
+
1126
+ if(isKioskMode())
1127
+ {
1128
+ permissionWindowShow = false;
1129
+ return;
1130
+ }
1131
+
1132
+ AlertDialog.Builder adb = new AlertDialog.Builder(this);
1133
+ adb.setTitle("Permission check")
1134
+ .setCancelable(false);
1135
+
1136
+ LinearLayout view = (LinearLayout) getLayoutInflater().inflate(R.layout.perrmission_alert_dialog, null);
1137
+ adb.setView(view);
1138
+
1139
+ Button restartApp = view.findViewById(R.id.restartBtn);
1140
+ restartApp.setOnClickListener(new Button.OnClickListener(){
1141
+ @Override
1142
+ public void onClick(View v) {
1143
+ IRhoInputListener listener = RhoInputListener.getListener();
1144
+ if(listener != null){
1145
+ mPermissionsDialog.cancel();
1146
+ listener.onRestartBrowser();
1147
+ }
1148
+ }
1149
+ });
1150
+
1151
+ mPermissionsDialog = adb.create();
1152
+
1153
+
1154
+ //===================== ACCESSIBILITY SERVICE =====================
1155
+
1156
+ Button asBtn = view.findViewById(R.id.accessibilityServiceBtn);
1157
+ ImageView asImg = view.findViewById(R.id.accessibilityServiceStatus);
1158
+
1159
+ asBtn.setVisibility(
1160
+ (!PermissionManager.checkAccessibilityServicePermission(this)?View.VISIBLE:View.GONE)
1161
+ );
1162
+ asImg.setVisibility(
1163
+ (PermissionManager.checkAccessibilityServicePermission(this)?View.VISIBLE:View.GONE)
1164
+ );
1165
+
1166
+ asBtn.setOnClickListener(new Button.OnClickListener(){
1167
+ @Override
1168
+ public void onClick(View v) {
1169
+ PermissionManager.setAccessibilityServicePermission(mActivity);
1170
+ //mPermissionsDialog.cancel();
1171
+ }
1172
+ });
1173
+
1174
+ //===================== NOTIFICATION SERVICE =====================
1175
+
1176
+ Button nBtn = view.findViewById(R.id.notificationServiceBtn);
1177
+ ImageView nImg = view.findViewById(R.id.notificationServiceStatus);
1178
+
1179
+ nBtn.setVisibility(
1180
+ (!PermissionManager.checkNotificationServicePermission(this, this)?View.VISIBLE:View.GONE)
1181
+ );
1182
+ nImg.setVisibility(
1183
+ (PermissionManager.checkNotificationServicePermission(this, this)?View.VISIBLE:View.GONE)
1184
+ );
1185
+
1186
+ nBtn.setOnClickListener(new Button.OnClickListener(){
1187
+ @Override
1188
+ public void onClick(View v) {
1189
+ PermissionManager.setNotificationServicePermission(mActivity);
1190
+ //mPermissionsDialog.cancel();
1191
+ }
1192
+ });
1193
+
1194
+ //===================== DEFAULT LAUNCHER =====================
1195
+
1196
+ Button dlBtn = view.findViewById(R.id.defaultLauncherBtn);
1197
+ ImageView dlImg = view.findViewById(R.id.defaultLauncherStatus);
1198
+
1199
+ dlBtn.setVisibility(
1200
+ (!PermissionManager.isMyLauncherDefault(this)?View.VISIBLE:View.GONE)
1201
+ );
1202
+ dlImg.setVisibility(
1203
+ (PermissionManager.isMyLauncherDefault(this)?View.VISIBLE:View.GONE)
1204
+ );
1205
+
1206
+ dlBtn.setOnClickListener(new Button.OnClickListener(){
1207
+ @Override
1208
+ public void onClick(View v) {
1209
+ PermissionManager.setDefaultLauncher(mActivity);
1210
+ //mPermissionsDialog.cancel();
1211
+ }
1212
+ });
1213
+
1214
+ //===================== CALL PHONE =====================
1215
+
1216
+ Button cpBtn = view.findViewById(R.id.callPhoneBtn);
1217
+ ImageView cpImg = view.findViewById(R.id.callPhoneStatus);
1218
+
1219
+ LinearLayout callPhoneLayout = view.findViewById(R.id.callPhoneLinearLayout);
1220
+ if( RhoConf.isExist("call_phone_permission_ignor") &&
1221
+ RhoConf.getBool("call_phone_permission_ignor")){
1222
+ callPhoneLayout.setVisibility(View.GONE);
1223
+ }else{
1224
+ callPhoneLayout.setVisibility(View.VISIBLE);
1225
+ }
1226
+
1227
+ cpBtn.setVisibility(
1228
+ (!PermissionManager.checkCallPhonePermission(this)?View.VISIBLE:View.GONE)
1229
+ );
1230
+ cpImg.setVisibility(
1231
+ (PermissionManager.checkCallPhonePermission(this)?View.VISIBLE:View.GONE)
1232
+ );
1233
+
1234
+ cpBtn.setOnClickListener(new Button.OnClickListener(){
1235
+ @Override
1236
+ public void onClick(View v) {
1237
+ PermissionManager.setCallPhonePermission(mActivity);
1238
+ //mPermissionsDialog.cancel();
1239
+ }
1240
+ });
1241
+
1242
+ //===================== OVERLAY PERMISSION =====================
1243
+
1244
+ Button oBtn = view.findViewById(R.id.overlayServiceBtn);
1245
+ ImageView oImg = view.findViewById(R.id.overlayServiceStatus);
1246
+
1247
+ oBtn.setVisibility(
1248
+ (!PermissionManager.checkOverlayPermission(this)?View.VISIBLE:View.GONE)
1249
+ );
1250
+ oImg.setVisibility(
1251
+ (PermissionManager.checkOverlayPermission(this)?View.VISIBLE:View.GONE)
1252
+ );
1253
+
1254
+ oBtn.setOnClickListener(new Button.OnClickListener(){
1255
+ @Override
1256
+ public void onClick(View v) {
1257
+ PermissionManager.setOverlayPermission(mActivity);
1258
+ //mPermissionsDialog.cancel();
1259
+ }
1260
+ });
1261
+
1262
+ try {
1263
+ mPermissionsDialog.show();
1264
+ }
1265
+ catch(Exception e) {
1266
+
1267
+ }
1268
+ }
1269
+
1270
+ public Context getCurrentContextForUI() {
1271
+ //MyOverlayService os = MyOverlayService.getInstance();
1272
+ //if (os != null) {
1273
+ // if (MyOverlayService.isOverlayMode()) {
1274
+ // return os;
1275
+ // }
1276
+ //}
1277
+ return this;
1278
+ }
1279
+
840
1280
  }