diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index fb503328..134ddf78 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,11 @@ - + - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 2c4c9feb..571b2479 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -108,9 +108,9 @@ dependencies { /* Ads Manager */ - implementation 'com.facebook.android:audience-network-sdk:6.8.0' - implementation 'com.applovin:applovin-sdk:11.3.1' - implementation 'com.applovin.mediation:facebook-adapter:6.8.0.12' + implementation 'com.applovin:applovin-sdk:+' + implementation 'com.applovin.mediation:mytarget-adapter:+' + implementation 'com.adcolony:sdk:4.8.0' /* Orbot Service */ diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/activityContextManager.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/activityContextManager.java index 90410659..c1eae870 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/activityContextManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/activityContextManager.java @@ -80,10 +80,17 @@ public class activityContextManager { } public homeController getHomeController() { - if (pHomeController == null) { - helperMethod.onStartApplication(pApplicationContext.get(), CONST_PACKAGE_NAME); + try { + if (pHomeController == null) { + if(pApplicationContext == null){ + return null; + } + helperMethod.onStartApplication(pApplicationContext.get(), CONST_PACKAGE_NAME); + } + return pHomeController.get(); + }catch (Exception ex){ + return null; } - return pHomeController.get(); } public void setApplicationContext(Context pContext) { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java index 24d83276..2952781a 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java @@ -45,7 +45,7 @@ public class externalURLNavigationContoller extends AppCompatActivity { return; } status.sExternalWebsiteLoading = true; - if (mData.toString().contains("applovin")) { + if (mData!=null && mData.toString().contains("applovin")) { Intent myIntent = new Intent(this, advertController.class); myIntent.putExtra(keys.ADVERT_URL, mData.toString()); myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION); diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java index e6626199..4eed565c 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java @@ -144,7 +144,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate { builder.setPositiveButton("Resend", listener); builder.setNegativeButton("Cancel", listener); - createStandardDialog(builder, prompt, res).show(); + try { + if(!((Activity) builder.getContext()).isFinishing()) + { + createStandardDialog(builder, prompt, res).show(); + } + }catch (Exception ex){} return res; } @@ -517,7 +522,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate { } else { throw new UnsupportedOperationException(); } - dialog.show(); + try { + if(!((Activity) builder.getContext()).isFinishing()) + { + dialog.show(); + } + }catch (Exception ex){} } @Override diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java index 7ca4879e..f8c568e7 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java @@ -912,6 +912,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchbar.setOnEditorActionListener((v, actionId, event) -> { if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) { + if(mGeckoClient == null || mGeckoClient.getSession() == null){ + return false; + } onSearchBarInvoked(v); if (!mSearchBarPreviousText.equals(mSearchbar.getText())) { mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, true, false); @@ -1740,11 +1743,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onStartApplication(View view) { if (!mStateService) { mStateService = true; - if (!isMyServiceRunning(activityStateManager.class)) { - new Handler().postDelayed(() -> - { - startService(new Intent(this, activityStateManager.class)); - }, 500); + try{ + if (!isMyServiceRunning(activityStateManager.class)) { + new Handler().postDelayed(() -> + { + startService(new Intent(this, activityStateManager.class)); + }, 500); + } + }catch (Exception ex){ + } } diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java index 84a02968..3a6bb085 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java @@ -3,12 +3,14 @@ package com.hiddenservices.onionservices.pluginManager.adPluginManager; import android.content.Context; import android.os.Handler; +import com.adcolony.sdk.AdColony; +import com.adcolony.sdk.AdColonyAppOptions; import com.applovin.mediation.MaxAd; import com.applovin.mediation.MaxAdViewAdListener; import com.applovin.mediation.MaxError; import com.applovin.mediation.ads.MaxAdView; import com.applovin.sdk.AppLovinSdk; -import com.facebook.ads.AdSettings; +import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.pluginManager.pluginEnums; @@ -23,7 +25,6 @@ public class appLovinManager implements MaxAdViewAdListener { private WeakReference mBannerAds; private int mRequestCount = 0; - private boolean bannerAdsLoaded = false; private boolean bannerAdRequested = false; /*Initializations*/ @@ -35,7 +36,9 @@ public class appLovinManager implements MaxAdViewAdListener { } private void initializeBannerAds(Context pContext) { - AdSettings.setDataProcessingOptions(new String[]{}); + AdColonyAppOptions appOptions = new AdColonyAppOptions(); + AdColony.configure(activityContextManager.getInstance().getHomeController(), appOptions,"app3b56c67c45544c5c89"); + AppLovinSdk.getInstance(pContext).setMediationProvider("max"); AppLovinSdk.initializeSdk(pContext, configuration -> { }); @@ -69,7 +72,6 @@ public class appLovinManager implements MaxAdViewAdListener { @Override public void onAdLoaded(MaxAd ad) { - bannerAdsLoaded = true; mEvent.invokeObserver(null, M_ON_AD_LOAD); } diff --git a/app/variables.gradle b/app/variables.gradle index a40cd27d..4c3c181a 100755 --- a/app/variables.gradle +++ b/app/variables.gradle @@ -1,6 +1,6 @@ /* Version */ -project.ext.vname = 'Build | Dark-Origin 1.0.5.5' -project.ext.vcode = 400 +project.ext.vname = 'Build | Dark-Origin 1.0.5.6' +project.ext.vcode = 405 project.ext.buildType = 'release' /* dimension */ diff --git a/gradle.properties b/gradle.properties index f6a98168..769fbc13 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,5 @@ android.useAndroidX=true android.enableJetifier=true kotlin.code.style=official org.gradle.jvmargs=-Xmx5048M -android.disableAutomaticComponentCreation=true \ No newline at end of file +android.disableAutomaticComponentCreation=true +android.bundle.enableUncompressedNativeLibs=false diff --git a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java index fa57d322..13a5ffcf 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java @@ -421,37 +421,26 @@ public class OrbotService extends VpnService implements OrbotConstants { isDestroyed=true; } - private void stopTorAsync(boolean showNotification) { - debug("stopTor"); + private void stopTorAsync(boolean notification) { - if (showNotification) sendCallbackLogMessage(getString(R.string.status_shutting_down)); + Log.i("OrbotService", "stopTor"); + try { + sendCallbackLogMessage(getString(R.string.status_shutting_down)); - if (Prefs.bridgesEnabled()) { if (useIPtObfsMeekProxy()) IPtProxy.stopObfs4Proxy(); - else if (useIPtSnowflakeProxyDomainFronting()) - IPtProxy.stopSnowflake(); - } - else if (Prefs.beSnowflakeProxy()) - disableSnowflakeProxy(); - - stopTor(); - showToolbarNotification(getString(R.string.status_starting_up), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); - - //stop the foreground priority and make sure to remove the persistent notification - stopForeground(!showNotification); - - if (showNotification) sendCallbackLogMessage(getString(R.string.status_disabled)); - - mPortDns = -1; - mPortSOCKS = -1; - mPortHTTP = -1; - mPortTrans = -1; - - if (!showNotification) { - clearNotifications(); - stopSelf(); + + stopTor(); + + //stop the foreground priority and make sure to remove the persistant notification + stopForeground(true); + + sendCallbackLogMessage(getString(R.string.status_disabled)); + } catch (Exception e) { + logNotice("An error occured stopping Tor: " + e.getMessage()); + sendCallbackLogMessage(getString(R.string.something_bad_happened)); } + clearNotifications(); } private void stopTorOnError(String message) { @@ -539,13 +528,25 @@ public class OrbotService extends VpnService implements OrbotConstants { } // if someone stops during startup, we may have to wait for the conn port to be setup, so we can properly shutdown tor - private void stopTor() { - if (shouldUnbindTorService) { - unbindService(torServiceConnection); //unbinding from the tor service will stop tor - shouldUnbindTorService = false; - conn = null; - } else { - sendLocalStatusOffBroadcast(); + private synchronized void stopTor() throws Exception { + + if (conn != null) { + logNotice("Using control port to shutdown Tor"); + + try { + logNotice("sending HALT signal to Tor process"); + conn.shutdownTor(TorControlCommands.SIGNAL_SHUTDOWN); + + if (shouldUnbindTorService) { + unbindService(torServiceConnection); + shouldUnbindTorService = false; + } + + conn = null; + + } catch (IOException e) { + Log.d(OrbotConstants.TAG, "error shutting down Tor via connection", e); + } } } @@ -1638,7 +1639,9 @@ public class OrbotService extends VpnService implements OrbotConstants { } case CMD_SETTING: { onSettingRegister(); - sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + try{ + sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + }catch (Exception ex){} break; } case ACTION_STATUS: {