mirror of https://github.com/LeOS-GSI/LeOS-Genesis
parent
1f7b4c6531
commit
1ab1f92e34
|
@ -21,6 +21,7 @@
|
||||||
<option value="$PROJECT_DIR$/autofillServices" />
|
<option value="$PROJECT_DIR$/autofillServices" />
|
||||||
<option value="$PROJECT_DIR$/chromiumTabs" />
|
<option value="$PROJECT_DIR$/chromiumTabs" />
|
||||||
<option value="$PROJECT_DIR$/httpclient" />
|
<option value="$PROJECT_DIR$/httpclient" />
|
||||||
|
<option value="$PROJECT_DIR$/intentintegrator" />
|
||||||
<option value="$PROJECT_DIR$/orbotservice" />
|
<option value="$PROJECT_DIR$/orbotservice" />
|
||||||
<option value="$PROJECT_DIR$/shutterbug" />
|
<option value="$PROJECT_DIR$/shutterbug" />
|
||||||
</set>
|
</set>
|
||||||
|
|
|
@ -144,4 +144,12 @@ dependencies {
|
||||||
implementation files('libs/httpclientandroidlib-1.2.1.jar')
|
implementation files('libs/httpclientandroidlib-1.2.1.jar')
|
||||||
implementation 'net.zetetic:android-database-sqlcipher:4.4.3@aar'
|
implementation 'net.zetetic:android-database-sqlcipher:4.4.3@aar'
|
||||||
|
|
||||||
|
implementation 'com.github.apl-devs:appintro:v4.2.2'
|
||||||
|
implementation 'androidx.palette:palette:1.0.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
|
||||||
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
|
implementation project(path: ':intentintegrator')
|
||||||
|
androidTestImplementation "tools.fastlane:screengrab:1.2.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,11 +193,6 @@
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:stopWithTask="true" />
|
android:stopWithTask="true" />
|
||||||
<service
|
|
||||||
android:name="org.torproject.android.service.OrbotService"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="false"
|
|
||||||
android:stopWithTask="true" />
|
|
||||||
<service
|
<service
|
||||||
android:name="com.darkweb.genesissearchengine.helperManager.OnClearFromRecentService"
|
android:name="com.darkweb.genesissearchengine.helperManager.OnClearFromRecentService"
|
||||||
android:stopWithTask="true" />
|
android:stopWithTask="true" />
|
||||||
|
@ -210,16 +205,6 @@
|
||||||
<action android:name="Download_Cancelled" />
|
<action android:name="Download_Cancelled" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver
|
|
||||||
android:name="org.torproject.android.service.StartTorReceiver"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="TODO"
|
|
||||||
android:stopWithTask="true"
|
|
||||||
tools:ignore="ExportedReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.torproject.android.intent.action.USER_PRESENT" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
@ -230,6 +215,26 @@
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="org.torproject.android.proxy.StartTorReceiver"
|
||||||
|
android:exported="true"
|
||||||
|
tools:ignore="ExportedReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.torproject.android.intent.action.START" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="org.torproject.android.proxy.OrbotService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||||
|
android:stopWithTask="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.net.VpnService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,7 @@ import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.net.VpnService;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -43,7 +44,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
|
|
||||||
import com.darkweb.genesissearchengine.databaseManager.databaseController;
|
import com.darkweb.genesissearchengine.databaseManager.databaseController;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||||
|
@ -81,10 +81,10 @@ import com.google.android.gms.ads.AdView;
|
||||||
import org.mozilla.geckoview.ContentBlocking;
|
import org.mozilla.geckoview.ContentBlocking;
|
||||||
import org.mozilla.geckoview.GeckoResult;
|
import org.mozilla.geckoview.GeckoResult;
|
||||||
import org.mozilla.geckoview.GeckoSession;
|
import org.mozilla.geckoview.GeckoSession;
|
||||||
import org.torproject.android.service.OrbotService;
|
import org.torproject.android.proxy.OrbotService;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
import org.torproject.android.service.wrapper.LocaleHelper;
|
import org.torproject.android.proxy.wrapper.LocaleHelper;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -108,6 +108,7 @@ import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessage
|
||||||
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
|
||||||
import static java.lang.Character.isLetter;
|
import static java.lang.Character.isLetter;
|
||||||
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
||||||
|
import static org.torproject.android.proxy.TorServiceConstants.REQUEST_VPN;
|
||||||
|
|
||||||
public class homeController extends AppCompatActivity implements ComponentCallbacks2
|
public class homeController extends AppCompatActivity implements ComponentCallbacks2
|
||||||
{
|
{
|
||||||
|
@ -1478,6 +1479,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
handler.postDelayed(() -> mGeckoView.clearFocus(), 500);
|
handler.postDelayed(() -> mGeckoView.clearFocus(), 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(requestCode == 7777){
|
||||||
|
if(resultCode == RESULT_OK){
|
||||||
|
status.sVPNPermission = true;
|
||||||
|
onStartVPNApplication();
|
||||||
|
}else {
|
||||||
|
status.sVPNPermission = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(requestCode==1){
|
else if(requestCode==1){
|
||||||
mGeckoClient.onUploadRequest(resultCode,data);
|
mGeckoClient.onUploadRequest(resultCode,data);
|
||||||
}
|
}
|
||||||
|
@ -1512,6 +1521,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartApplication(View view){
|
public void onStartApplication(View view){
|
||||||
|
Intent intentVPN = VpnService.prepare(this);
|
||||||
|
if(status.sVPNStatus && intentVPN!=null){
|
||||||
|
startActivityForResult(intentVPN, REQUEST_VPN);
|
||||||
|
}else{
|
||||||
|
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_START_ORBOT);
|
||||||
|
onInvokeProxyLoading();
|
||||||
|
mHomeViewController.initHomePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStartVPNApplication(){
|
||||||
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_START_ORBOT);
|
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_START_ORBOT);
|
||||||
onInvokeProxyLoading();
|
onInvokeProxyLoading();
|
||||||
mHomeViewController.initHomePage();
|
mHomeViewController.initHomePage();
|
||||||
|
|
|
@ -48,7 +48,7 @@ import com.example.myapplication.R;
|
||||||
import com.google.android.gms.ads.AdView;
|
import com.google.android.gms.ads.AdView;
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import org.mozilla.geckoview.GeckoView;
|
import org.mozilla.geckoview.GeckoView;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1028,6 +1028,7 @@ class homeViewController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("WrongConstant")
|
||||||
public void onUpdateSearchEngineBar(boolean pStatus, int delay)
|
public void onUpdateSearchEngineBar(boolean pStatus, int delay)
|
||||||
{
|
{
|
||||||
if(pStatus){
|
if(pStatus){
|
||||||
|
@ -1275,6 +1276,7 @@ class homeViewController
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(flags);
|
mContext.getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||||
|
mContext.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
|
||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
mTopBar.setVisibility(View.GONE);
|
mTopBar.setVisibility(View.GONE);
|
||||||
|
@ -1320,6 +1322,7 @@ class homeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> mBlockerFullSceen.setVisibility(View.GONE));
|
this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> mBlockerFullSceen.setVisibility(View.GONE));
|
||||||
|
mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
initTopBarPadding();
|
initTopBarPadding();
|
||||||
mAppBar.setExpanded(true,false);
|
mAppBar.setExpanded(true,false);
|
||||||
mAppBar.refreshDrawableState();
|
mAppBar.refreshDrawableState();
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
|
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import org.torproject.android.service.wrapper.logRowModel;
|
import org.torproject.android.proxy.wrapper.logRowModel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,9 @@ package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -26,7 +24,7 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
|
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@ package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import org.torproject.android.service.wrapper.logRowModel;
|
import org.torproject.android.proxy.wrapper.logRowModel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
class orbotLogModel
|
class orbotLogModel
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.appManager.orbotManager;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.net.VpnService;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class constants
|
||||||
public static final String CONST_GENESIS_ERROR_CACHED_DARK = "error/error-dark.html";
|
public static final String CONST_GENESIS_ERROR_CACHED_DARK = "error/error-dark.html";
|
||||||
public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://boogle.store/";
|
public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://boogle.store/";
|
||||||
public static final String CONST_GENESIS_REFERENCE_WEBSITES = "https://drive.google.com/uc?export=download&id=1lOmukKOPYHApBFyTDkaRPoAwm59E_YEE";
|
public static final String CONST_GENESIS_REFERENCE_WEBSITES = "https://drive.google.com/uc?export=download&id=1lOmukKOPYHApBFyTDkaRPoAwm59E_YEE";
|
||||||
|
public static final String CONST_GENESIS_BRIDGE_WEBSITES = "https://drive.google.com/uc?export=download&id=1EIX0ERNxDesCv8yc65reEn4LV6Y1PjbR";
|
||||||
public static final String CONST_GENESIS_DOMAIN_URL = "https://boogle.store";
|
public static final String CONST_GENESIS_DOMAIN_URL = "https://boogle.store";
|
||||||
public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken";
|
public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken";
|
||||||
public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pGlobalTimeVerificationToken";
|
public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pGlobalTimeVerificationToken";
|
||||||
|
|
|
@ -63,5 +63,6 @@ public class keys
|
||||||
public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1";
|
public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1";
|
||||||
public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1";
|
public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1";
|
||||||
public static final String VPN_ENABLED = "pref_vpn_V1";
|
public static final String VPN_ENABLED = "pref_vpn_V1";
|
||||||
|
public static final String BRIDGE_DEFAULT = "BRIDGE_DEFAULT";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class status
|
||||||
public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR;
|
public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR;
|
||||||
public static String sVersion = "";
|
public static String sVersion = "";
|
||||||
public static String sExternalWebsite = strings.GENERIC_EMPTY_STR;
|
public static String sExternalWebsite = strings.GENERIC_EMPTY_STR;
|
||||||
|
public static String sBridgesDefault = strings.BRIDGES_DEFAULT;
|
||||||
|
|
||||||
public static boolean sSettingEnableZoom = true;
|
public static boolean sSettingEnableZoom = true;
|
||||||
public static boolean sSettingEnableVoiceInput = true;
|
public static boolean sSettingEnableVoiceInput = true;
|
||||||
|
@ -61,6 +62,7 @@ public class status
|
||||||
public static boolean sBridgeGatewayAuto = false;
|
public static boolean sBridgeGatewayAuto = false;
|
||||||
public static boolean sBridgeGatewayManual = false;
|
public static boolean sBridgeGatewayManual = false;
|
||||||
public static boolean sVPNStatus = false;
|
public static boolean sVPNStatus = false;
|
||||||
|
public static boolean sVPNPermission = false;
|
||||||
public static boolean sBridgeStatus = false;
|
public static boolean sBridgeStatus = false;
|
||||||
|
|
||||||
public static int sTheme = enums.Theme.THEME_DEFAULT;
|
public static int sTheme = enums.Theme.THEME_DEFAULT;
|
||||||
|
@ -111,6 +113,7 @@ public class status
|
||||||
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
||||||
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
|
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
|
||||||
status.sBridgeCustomType = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.GENERIC_EMPTY_SPACE));
|
status.sBridgeCustomType = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.GENERIC_EMPTY_SPACE));
|
||||||
|
status.sBridgesDefault = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_DEFAULT,strings.BRIDGES_DEFAULT));
|
||||||
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
|
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
|
||||||
status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
|
status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
|
||||||
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
|
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
|
||||||
|
|
|
@ -28,6 +28,18 @@ public class strings
|
||||||
|
|
||||||
public static final String BRIDGE_CUSTOM_BRIDGE_OBFS4 = "obfs4";
|
public static final String BRIDGE_CUSTOM_BRIDGE_OBFS4 = "obfs4";
|
||||||
public static final String BRIDGE_CUSTOM_BRIDGE_MEEK = "meek";
|
public static final String BRIDGE_CUSTOM_BRIDGE_MEEK = "meek";
|
||||||
|
public static final String BRIDGES_DEFAULT = "obfs4 78.215.187.186:45675 AE907EE5FAA5D0D27E0C83EFA6ADF8E79FCC0FF1 cert=/TRjMo+RinKaixARMjMtZZBhystaBe+aDaapPrbiITFtWx3M/AJcvpjHjO54tJqLd1+IWQ iat-mode=0\n" +
|
||||||
|
"obfs4 107.160.7.24:443 7A0904F6D182B81BEFE0DEDAFEC974494672627B cert=a5/IlZMnDvb8d92LTHMfsBIgL7QlDLPiXiLwe85uedC80mGD0QerygzmsWnMEdwG9ER9Eg iat-mode=0\n" +
|
||||||
|
"obfs4 79.136.160.201:46501 66AC975BF7CB429D057AE07FC0312C57D61BAEC1 cert=dCtn9Ya8z+R8YQikdWgC3XTAt58z5Apnm95QHrJwnhFSdnphPPEz+NMm6OawWc2srKLjJg iat-mode=0\n" +
|
||||||
|
"obfs4 94.242.249.2:58809 6AF3024788A7EA8F84E3FA3F60018B62291803E4 cert=X0sDCJLKMM/EISdGDEfGrsks41UYmScjIIXQ9AZgWFVKNKS6klcNEpdF4tNXFz6kIyk4Ug iat-mode=0\n" +
|
||||||
|
"obfs4 35.203.134.33:2224 15524C683CC872C8C8FB5B779A8D53F54F7ADCD4 cert=bXLTv0Kwt1zgPBoeVF86vC+0tYAHepR7+QMczhhTQw9hpAIhatt/Bpe6rSGY63Zh8aZ+dQ iat-mode=0\n" +
|
||||||
|
"obfs4 188.166.252.228:9443 595770328CA95E39FF5B81013880B46CA1B29546 cert=3PjhGUq3xWDMrBAzbV1eU4zPSB3GRGBpYdXQEs9hkrwC9RSZdnEe1P+cg7VgLgYTj/2MMg iat-mode=0\n" +
|
||||||
|
"obfs4 89.163.181.169:443 6A17D1E29E2807A1A4314215553079001031A7FF cert=e8JIYivx1zbYNOqq3a3+nDf/NDHoDQ/th/RVAnlVQePUIHxllG7aOku7pSwZisZ7i6ybVw iat-mode=0\n" +
|
||||||
|
"obfs4 94.242.249.2:40190 C7BE8154678E7537CCAC60B097D51A8A7EF8BCDF cert=8jw57wlMlVXCKsCnF7gCdApx7sRZLD5zPl8qdccwp0zltYG6kMYqBNm60dP8IxRH/l8OcQ iat-mode=0\n" +
|
||||||
|
"obfs4 77.81.104.251:443 115C90EBD0EB631C177560A872535772215478D9 cert=UsuF7oN4KNKviZP54JOyTCoCphrdM5gwZK4vT8GnCAcmqLUJEJxyw1dpko9a/ii6He4iZg iat-mode=0\n" +
|
||||||
|
"obfs4 5.249.146.133:80 FAF3A0073330D6AD92F3B4874B0D945562A633EF cert=TRe8bAODtjcGij7EPQaUayWEOqR99wDh2l3B4hFtCsn1JTJCph03pRZ9tx8wynpLYKWMQg iat-mode=0\n" +
|
||||||
|
"meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com\n" +
|
||||||
|
"snowflake 192.0.2.3:1";
|
||||||
|
|
||||||
/*Generic*/
|
/*Generic*/
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.darkweb.genesissearchengine.dataManager;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.android.volley.Request;
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
|
import com.android.volley.toolbox.StringRequest;
|
||||||
|
import com.android.volley.toolbox.Volley;
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_BRIDGE_WEBSITES;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_REFERENCE_WEBSITES;
|
||||||
|
|
||||||
|
public class bridgesDataModel {
|
||||||
|
|
||||||
|
private String mBridges = "null";
|
||||||
|
private boolean mLoading = false;
|
||||||
|
|
||||||
|
public bridgesDataModel(){
|
||||||
|
mBridges = status.sBridgesDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onLoad(Context pContext){
|
||||||
|
if(!mLoading){
|
||||||
|
mLoading = true;
|
||||||
|
|
||||||
|
StringRequest stringRequest = new StringRequest(Request.Method.GET, CONST_GENESIS_BRIDGE_WEBSITES,
|
||||||
|
response -> {
|
||||||
|
if(response.length()>10){
|
||||||
|
mBridges = response;
|
||||||
|
status.sBridgesDefault = response;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_DEFAULT,strings.BRIDGES_DEFAULT));
|
||||||
|
mLoading = false;
|
||||||
|
}else {
|
||||||
|
mBridges = status.sReferenceWebsites;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error -> {
|
||||||
|
mBridges = status.sReferenceWebsites;
|
||||||
|
mLoading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
RequestQueue requestQueue = Volley.newRequestQueue(pContext);
|
||||||
|
requestQueue.add(stringRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String onFetch(){
|
||||||
|
try {
|
||||||
|
return mBridges;
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
return strings.GENERIC_EMPTY_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(dataEnums.eBridgeWebsiteCommands p_commands, List<Object> pData){
|
||||||
|
if(p_commands == dataEnums.eBridgeWebsiteCommands.M_LOAD){
|
||||||
|
onLoad((Context) pData.get(0));
|
||||||
|
}
|
||||||
|
if(p_commands == dataEnums.eBridgeWebsiteCommands.M_FETCH){
|
||||||
|
return onFetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ public class dataController
|
||||||
private suggestionDataModel mSuggestionDataModel;
|
private suggestionDataModel mSuggestionDataModel;
|
||||||
private helpDataModel mHelpDataModel;
|
private helpDataModel mHelpDataModel;
|
||||||
private referenceWebsiteDataModel mReferenceWebsiteDataModel;
|
private referenceWebsiteDataModel mReferenceWebsiteDataModel;
|
||||||
|
private bridgesDataModel mBridgeWebsiteDataModel;
|
||||||
|
|
||||||
/*Private Declarations*/
|
/*Private Declarations*/
|
||||||
|
|
||||||
|
@ -43,9 +44,11 @@ public class dataController
|
||||||
mSuggestionDataModel = new suggestionDataModel(pAppContext);
|
mSuggestionDataModel = new suggestionDataModel(pAppContext);
|
||||||
mHelpDataModel = new helpDataModel();
|
mHelpDataModel = new helpDataModel();
|
||||||
mReferenceWebsiteDataModel = new referenceWebsiteDataModel();
|
mReferenceWebsiteDataModel = new referenceWebsiteDataModel();
|
||||||
|
mBridgeWebsiteDataModel = new bridgesDataModel();
|
||||||
}
|
}
|
||||||
public void initializeListData(){
|
public void initializeListData(){
|
||||||
mReferenceWebsiteDataModel.onTrigger(dataEnums.eReferenceWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController()));
|
mReferenceWebsiteDataModel.onTrigger(dataEnums.eReferenceWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController()));
|
||||||
|
mBridgeWebsiteDataModel.onTrigger(dataEnums.eBridgeWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController()));
|
||||||
mBookmarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
|
mBookmarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
|
||||||
if(!status.sClearOnExit)
|
if(!status.sClearOnExit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,10 @@ public class dataEnums
|
||||||
M_LOAD, M_FETCH;
|
M_LOAD, M_FETCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum eBridgeWebsiteCommands {
|
||||||
|
M_LOAD, M_FETCH;
|
||||||
|
}
|
||||||
|
|
||||||
public enum ePreferencesCommands{
|
public enum ePreferencesCommands{
|
||||||
M_SET_STRING, M_SET_BOOL, M_SET_INT, M_SET_FLOAT, M_GET_STRING, M_GET_BOOL, M_GET_INT, M_GET_FLOAT, M_CLEAR_PREFS
|
M_SET_STRING, M_SET_BOOL, M_SET_INT, M_SET_FLOAT, M_GET_STRING, M_GET_BOOL, M_GET_INT, M_GET_FLOAT, M_CLEAR_PREFS
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import androidx.core.content.FileProvider;
|
||||||
import com.darkweb.genesissearchengine.netcipher.client.StrongHttpsClient;
|
import com.darkweb.genesissearchengine.netcipher.client.StrongHttpsClient;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log;
|
import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
package com.darkweb.genesissearchengine.pluginManager;
|
package com.darkweb.genesissearchengine.pluginManager;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.VpnService;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import org.mozilla.gecko.PrefsHelper;
|
import org.mozilla.gecko.PrefsHelper;
|
||||||
import org.torproject.android.service.OrbotService;
|
import org.torproject.android.proxy.OrbotService;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.TorServiceConstants;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.darkweb.genesissearchengine.constants.*;
|
import com.darkweb.genesissearchengine.constants.*;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_START;
|
import static org.torproject.android.proxy.TorServiceConstants.ACTION_START;
|
||||||
|
import static org.torproject.android.proxy.TorServiceConstants.ACTION_START_VPN;
|
||||||
|
import static org.torproject.android.proxy.TorServiceConstants.REQUEST_VPN;
|
||||||
|
|
||||||
// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md
|
// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md
|
||||||
class orbotManager
|
class orbotManager
|
||||||
|
@ -45,20 +48,31 @@ class orbotManager
|
||||||
orbotLocalConstants.mBridges = status.sBridgeCustomBridge;
|
orbotLocalConstants.mBridges = status.sBridgeCustomBridge;
|
||||||
orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual;
|
orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual;
|
||||||
orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType;
|
orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType;
|
||||||
|
orbotLocalConstants.mBridgesDefault = status.sBridgesDefault;
|
||||||
Prefs.putBridgesEnabled(status.sBridgeStatus);
|
Prefs.putBridgesEnabled(status.sBridgeStatus);
|
||||||
Intent mServiceIntent = new Intent(mAppContext.get(), OrbotService.class);
|
isVPNEnabled();
|
||||||
mServiceIntent.setAction(ACTION_START);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
mAppContext.get().getApplicationContext().startForegroundService(mServiceIntent);
|
//mAppContext.get().getApplicationContext().startForegroundService(mServiceIntent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mAppContext.get().getApplicationContext().startService(mServiceIntent);
|
//mAppContext.get().getApplicationContext().startService(mServiceIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeProxy();
|
initializeProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendIntentToService(final String action) {
|
||||||
|
Intent intent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class);
|
||||||
|
intent.setAction(action);
|
||||||
|
mAppContext.get().startService(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void isVPNEnabled(){
|
||||||
|
sendIntentToService(TorServiceConstants.ACTION_START);
|
||||||
|
sendIntentToService(TorServiceConstants.ACTION_START_VPN);
|
||||||
|
}
|
||||||
|
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
private int onGetNotificationStatus(){
|
private int onGetNotificationStatus(){
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
obfs4 212.21.66.66:20621 986E06A61EC62DC0DD58E0A1BB6EE54463EF408A cert=ifbMX0EZ6eqTfCuyiiR0LDEZVX2UVGHEFvqbu5qb6wCZELi5WYhEEWIIBek5MSvyTQx3CA iat-mode=0
|
obfs4 185.220.101.165:12346 B3E9AA2080C976E18EDD6AD06A317001172BF3C2 cert=p9L6+25s8bnfkye1ZxFeAE4mAGY7DH4Gaj7dxngIIzP9BtqrHHwZXdjMK0RVIQ34C7aqZw iat-mode=2
|
||||||
obfs4 107.161.122.123:443 2AE7DECA0503D7EC3EC36E05A288DF02D253A8F6 cert=yDSCNEdxDFxjN/mCBKTN9inUQPZk/L4WMscpsYNDFZ2mE0hK6c+t6HYwWk7JwugzqA0qfg iat-mode=0
|
obfs4 69.51.20.56:443 7F4EA8DFB5555304763FBF62BDFF29B8F73BF5F7 cert=ppU2EsiAw76IG7MU7h2KtxiqXDuaxglQkfWTC5I3xElskhnlvmW30Gqd3Wi3x2rCCb/TGA iat-mode=0
|
||||||
obfs4 92.223.72.163:8080 38C33A4956DD31CA29B0BE00135DB5D60B20EAFD cert=Av+pzqmvUCpPbjjiXCFClIEKdcDgB97cN3wfWbRGdHNC3PFck6dHbDow+hvr01vzjZmvVw iat-mode=0
|
obfs4 185.162.248.147:10111 7207F204CC4E242688FFA252599E51DDA776C01D cert=e3LSXtFXpmAP5pcW2UgSMwi4QaOeRiFxzXj6v9FXpD8yjjZhtcO2PDwBx+vdx4Wb5W3yTw iat-mode=0
|
||||||
meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
||||||
|
snowflake 192.0.2.3:1
|
|
@ -319,7 +319,7 @@ static const u_short fcstab[256] = {
|
||||||
0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
|
0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
|
||||||
0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
|
0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
|
||||||
0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
|
0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
|
||||||
0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
|
0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8118, 0xb3bb, 0xa232,
|
||||||
0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
|
0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
|
||||||
0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
|
0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
|
||||||
0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
|
0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
|
@ -0,0 +1,30 @@
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 30
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 16
|
||||||
|
targetSdkVersion 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,5 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.google.zxing.integration.android">
|
||||||
|
|
||||||
|
/
|
||||||
|
</manifest>
|
|
@ -0,0 +1,502 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 ZXing authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.zxing.integration.android;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple
|
||||||
|
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
|
||||||
|
* project's source code.</p>
|
||||||
|
*
|
||||||
|
* <h2>Initiating a barcode scan</h2>
|
||||||
|
*
|
||||||
|
* <p>To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait
|
||||||
|
* for the result in your app.</p>
|
||||||
|
*
|
||||||
|
* <p>It does require that the Barcode Scanner (or work-alike) application is installed. The
|
||||||
|
* {@link #initiateScan()} method will prompt the user to download the application, if needed.</p>
|
||||||
|
*
|
||||||
|
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement
|
||||||
|
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
|
||||||
|
*
|
||||||
|
* <pre>{@code
|
||||||
|
* public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
|
* IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
||||||
|
* if (scanResult != null) {
|
||||||
|
* // handle scan result
|
||||||
|
* }
|
||||||
|
* // else continue with any other code you need in the method
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* }</pre>
|
||||||
|
*
|
||||||
|
* <p>This is where you will handle a scan result.</p>
|
||||||
|
*
|
||||||
|
* <p>Second, just call this in response to a user action somewhere to begin the scan process:</p>
|
||||||
|
*
|
||||||
|
* <pre>{@code
|
||||||
|
* IntentIntegrator integrator = new IntentIntegrator(yourActivity);
|
||||||
|
* integrator.initiateScan();
|
||||||
|
* }</pre>
|
||||||
|
*
|
||||||
|
* <p>Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the
|
||||||
|
* user was prompted to download the application. This lets the calling app potentially manage the dialog.
|
||||||
|
* In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()}
|
||||||
|
* method.</p>
|
||||||
|
*
|
||||||
|
* <p>You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use
|
||||||
|
* {@link #setTitleByID(int)} to set the title by string resource ID.) Likewise, the prompt message, and
|
||||||
|
* yes/no button labels can be changed.</p>
|
||||||
|
*
|
||||||
|
* <p>Finally, you can use {@link #addExtra(String, Object)} to add more parameters to the Intent used
|
||||||
|
* to invoke the scanner. This can be used to set additional options not directly exposed by this
|
||||||
|
* simplified API.</p>
|
||||||
|
*
|
||||||
|
* <p>By default, this will only allow applications that are known to respond to this intent correctly
|
||||||
|
* do so. The apps that are allowed to response can be set with {@link #setTargetApplications(List)}.
|
||||||
|
* For example, set to {@link #TARGET_BARCODE_SCANNER_ONLY} to only target the Barcode Scanner app itself.</p>
|
||||||
|
*
|
||||||
|
* <h2>Sharing text via barcode</h2>
|
||||||
|
*
|
||||||
|
* <p>To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(CharSequence)}.</p>
|
||||||
|
*
|
||||||
|
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
|
||||||
|
*
|
||||||
|
* <h2>Enabling experimental barcode formats</h2>
|
||||||
|
*
|
||||||
|
* <p>Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as
|
||||||
|
* PDF417. Use {@link #initiateScan(java.util.Collection)} with
|
||||||
|
* a collection containing the names of formats to scan for explicitly, like "PDF_417", to use such
|
||||||
|
* formats.</p>
|
||||||
|
*
|
||||||
|
* @author Sean Owen
|
||||||
|
* @author Fred Lin
|
||||||
|
* @author Isaac Potoczny-Jones
|
||||||
|
* @author Brad Drehmer
|
||||||
|
* @author gcstang
|
||||||
|
*/
|
||||||
|
public class IntentIntegrator {
|
||||||
|
|
||||||
|
public static final int REQUEST_CODE = 0x0000c0de; // Only use bottom 16 bits
|
||||||
|
private static final String TAG = IntentIntegrator.class.getSimpleName();
|
||||||
|
|
||||||
|
public static final String DEFAULT_TITLE = "Install Barcode Scanner?";
|
||||||
|
public static final String DEFAULT_MESSAGE =
|
||||||
|
"This application requires Barcode Scanner. Would you like to install it?";
|
||||||
|
public static final String DEFAULT_YES = "Yes";
|
||||||
|
public static final String DEFAULT_NO = "No";
|
||||||
|
|
||||||
|
private static final String BS_PACKAGE = "com.google.zxing.client.android";
|
||||||
|
private static final String BSPLUS_PACKAGE = "com.srowen.bs.android";
|
||||||
|
|
||||||
|
// supported barcode formats
|
||||||
|
public static final Collection<String> PRODUCT_CODE_TYPES = list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "RSS_14");
|
||||||
|
public static final Collection<String> ONE_D_CODE_TYPES =
|
||||||
|
list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "CODE_39", "CODE_93", "CODE_128",
|
||||||
|
"ITF", "RSS_14", "RSS_EXPANDED");
|
||||||
|
public static final Collection<String> QR_CODE_TYPES = Collections.singleton("QR_CODE");
|
||||||
|
public static final Collection<String> DATA_MATRIX_TYPES = Collections.singleton("DATA_MATRIX");
|
||||||
|
|
||||||
|
public static final Collection<String> ALL_CODE_TYPES = null;
|
||||||
|
|
||||||
|
public static final List<String> TARGET_BARCODE_SCANNER_ONLY = Collections.singletonList(BS_PACKAGE);
|
||||||
|
public static final List<String> TARGET_ALL_KNOWN = list(
|
||||||
|
BSPLUS_PACKAGE, // Barcode Scanner+
|
||||||
|
BSPLUS_PACKAGE + ".simple", // Barcode Scanner+ Simple
|
||||||
|
BS_PACKAGE // Barcode Scanner
|
||||||
|
// What else supports this intent?
|
||||||
|
);
|
||||||
|
|
||||||
|
private final Activity activity;
|
||||||
|
private final Fragment fragment;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String message;
|
||||||
|
private String buttonYes;
|
||||||
|
private String buttonNo;
|
||||||
|
private List<String> targetApplications;
|
||||||
|
private final Map<String,Object> moreExtras = new HashMap<String,Object>(3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param activity {@link Activity} invoking the integration
|
||||||
|
*/
|
||||||
|
public IntentIntegrator(Activity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
this.fragment = null;
|
||||||
|
initializeConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fragment {@link Fragment} invoking the integration.
|
||||||
|
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
|
||||||
|
* of an {@link Activity}
|
||||||
|
*/
|
||||||
|
public IntentIntegrator(Fragment fragment) {
|
||||||
|
this.activity = fragment.getActivity();
|
||||||
|
this.fragment = fragment;
|
||||||
|
initializeConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeConfiguration() {
|
||||||
|
title = DEFAULT_TITLE;
|
||||||
|
message = DEFAULT_MESSAGE;
|
||||||
|
buttonYes = DEFAULT_YES;
|
||||||
|
buttonNo = DEFAULT_NO;
|
||||||
|
targetApplications = TARGET_ALL_KNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleByID(int titleID) {
|
||||||
|
title = activity.getString(titleID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageByID(int messageID) {
|
||||||
|
message = activity.getString(messageID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButtonYes() {
|
||||||
|
return buttonYes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonYes(String buttonYes) {
|
||||||
|
this.buttonYes = buttonYes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonYesByID(int buttonYesID) {
|
||||||
|
buttonYes = activity.getString(buttonYesID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButtonNo() {
|
||||||
|
return buttonNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonNo(String buttonNo) {
|
||||||
|
this.buttonNo = buttonNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonNoByID(int buttonNoID) {
|
||||||
|
buttonNo = activity.getString(buttonNoID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<String> getTargetApplications() {
|
||||||
|
return targetApplications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setTargetApplications(List<String> targetApplications) {
|
||||||
|
if (targetApplications.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("No target applications");
|
||||||
|
}
|
||||||
|
this.targetApplications = targetApplications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSingleTargetApplication(String targetApplication) {
|
||||||
|
this.targetApplications = Collections.singletonList(targetApplication);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,?> getMoreExtras() {
|
||||||
|
return moreExtras;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void addExtra(String key, Object value) {
|
||||||
|
moreExtras.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates a scan for all known barcode types with the default camera.
|
||||||
|
*
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise.
|
||||||
|
*/
|
||||||
|
public final AlertDialog initiateScan() {
|
||||||
|
return initiateScan(ALL_CODE_TYPES, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates a scan for all known barcode types with the specified camera.
|
||||||
|
*
|
||||||
|
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise.
|
||||||
|
*/
|
||||||
|
public final AlertDialog initiateScan(int cameraId) {
|
||||||
|
return initiateScan(ALL_CODE_TYPES, cameraId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates a scan, using the default camera, only for a certain set of barcode types, given as strings corresponding
|
||||||
|
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
|
||||||
|
* like {@link #PRODUCT_CODE_TYPES} for example.
|
||||||
|
*
|
||||||
|
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise.
|
||||||
|
*/
|
||||||
|
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
|
||||||
|
return initiateScan(desiredBarcodeFormats, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding
|
||||||
|
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
|
||||||
|
* like {@link #PRODUCT_CODE_TYPES} for example.
|
||||||
|
*
|
||||||
|
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
||||||
|
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise
|
||||||
|
*/
|
||||||
|
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
|
||||||
|
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
|
||||||
|
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
|
||||||
|
// check which types of codes to scan for
|
||||||
|
if (desiredBarcodeFormats != null) {
|
||||||
|
// set the desired barcode types
|
||||||
|
StringBuilder joinedByComma = new StringBuilder();
|
||||||
|
for (String format : desiredBarcodeFormats) {
|
||||||
|
if (joinedByComma.length() > 0) {
|
||||||
|
joinedByComma.append(',');
|
||||||
|
}
|
||||||
|
joinedByComma.append(format);
|
||||||
|
}
|
||||||
|
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// check requested camera ID
|
||||||
|
if (cameraId >= 0) {
|
||||||
|
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String targetAppPackage = findTargetAppPackage(intentScan);
|
||||||
|
if (targetAppPackage == null) {
|
||||||
|
return showDownloadDialog();
|
||||||
|
}
|
||||||
|
intentScan.setPackage(targetAppPackage);
|
||||||
|
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
|
attachMoreExtras(intentScan);
|
||||||
|
startActivityForResult(intentScan, REQUEST_CODE);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start an activity. This method is defined to allow different methods of activity starting for
|
||||||
|
* newer versions of Android and for compatibility library.
|
||||||
|
*
|
||||||
|
* @param intent Intent to start.
|
||||||
|
* @param code Request code for the activity
|
||||||
|
* @see android.app.Activity#startActivityForResult(Intent, int)
|
||||||
|
* @see android.app.Fragment#startActivityForResult(Intent, int)
|
||||||
|
*/
|
||||||
|
protected void startActivityForResult(Intent intent, int code) {
|
||||||
|
if (fragment == null) {
|
||||||
|
activity.startActivityForResult(intent, code);
|
||||||
|
} else {
|
||||||
|
fragment.startActivityForResult(intent, code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String findTargetAppPackage(Intent intent) {
|
||||||
|
PackageManager pm = activity.getPackageManager();
|
||||||
|
List<ResolveInfo> availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
|
if (availableApps != null) {
|
||||||
|
for (String targetApp : targetApplications) {
|
||||||
|
if (contains(availableApps, targetApp)) {
|
||||||
|
return targetApp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean contains(Iterable<ResolveInfo> availableApps, String targetApp) {
|
||||||
|
for (ResolveInfo availableApp : availableApps) {
|
||||||
|
String packageName = availableApp.activityInfo.packageName;
|
||||||
|
if (targetApp.equals(packageName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AlertDialog showDownloadDialog() {
|
||||||
|
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity);
|
||||||
|
downloadDialog.setTitle(title);
|
||||||
|
downloadDialog.setMessage(message);
|
||||||
|
downloadDialog.setPositiveButton(buttonYes, (dialogInterface, i) -> {
|
||||||
|
String packageName;
|
||||||
|
if (targetApplications.contains(BS_PACKAGE)) {
|
||||||
|
// Prefer to suggest download of BS if it's anywhere in the list
|
||||||
|
packageName = BS_PACKAGE;
|
||||||
|
} else {
|
||||||
|
// Otherwise, first option:
|
||||||
|
packageName = targetApplications.get(0);
|
||||||
|
}
|
||||||
|
Uri uri = Uri.parse("market://details?id=" + packageName);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
try {
|
||||||
|
if (fragment == null) {
|
||||||
|
activity.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
fragment.startActivity(intent);
|
||||||
|
}
|
||||||
|
} catch (ActivityNotFoundException anfe) {
|
||||||
|
// Hmm, market is not installed
|
||||||
|
Log.w(TAG, "Google Play is not installed; cannot install " + packageName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
downloadDialog.setNegativeButton(buttonNo, null);
|
||||||
|
downloadDialog.setCancelable(true);
|
||||||
|
return downloadDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Call this from your {@link Activity}'s
|
||||||
|
* {@link Activity#onActivityResult(int, int, Intent)} method.</p>
|
||||||
|
*
|
||||||
|
* @param requestCode request code from {@code onActivityResult()}
|
||||||
|
* @param resultCode result code from {@code onActivityResult()}
|
||||||
|
* @param intent {@link Intent} from {@code onActivityResult()}
|
||||||
|
* @return null if the event handled here was not related to this class, or
|
||||||
|
* else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning,
|
||||||
|
* the fields will be null.
|
||||||
|
*/
|
||||||
|
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
|
if (requestCode == REQUEST_CODE) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
String contents = intent.getStringExtra("SCAN_RESULT");
|
||||||
|
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
|
||||||
|
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
|
||||||
|
int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
|
||||||
|
Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
|
||||||
|
String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
|
||||||
|
return new IntentResult(contents,
|
||||||
|
formatName,
|
||||||
|
rawBytes,
|
||||||
|
orientation,
|
||||||
|
errorCorrectionLevel);
|
||||||
|
}
|
||||||
|
return new IntentResult();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defaults to type "TEXT_TYPE".
|
||||||
|
*
|
||||||
|
* @param text the text string to encode as a barcode
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise
|
||||||
|
* @see #shareText(CharSequence, CharSequence)
|
||||||
|
*/
|
||||||
|
public final AlertDialog shareText(CharSequence text) {
|
||||||
|
return shareText(text, "TEXT_TYPE");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shares the given text by encoding it as a barcode, such that another user can
|
||||||
|
* scan the text off the screen of the device.
|
||||||
|
*
|
||||||
|
* @param text the text string to encode as a barcode
|
||||||
|
* @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
|
||||||
|
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
||||||
|
* if a prompt was needed, or null otherwise
|
||||||
|
*/
|
||||||
|
public final AlertDialog shareText(CharSequence text, CharSequence type) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
intent.setAction(BS_PACKAGE + ".ENCODE");
|
||||||
|
intent.putExtra("ENCODE_TYPE", type);
|
||||||
|
intent.putExtra("ENCODE_DATA", text);
|
||||||
|
String targetAppPackage = findTargetAppPackage(intent);
|
||||||
|
if (targetAppPackage == null) {
|
||||||
|
return showDownloadDialog();
|
||||||
|
}
|
||||||
|
intent.setPackage(targetAppPackage);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||||
|
attachMoreExtras(intent);
|
||||||
|
if (fragment == null) {
|
||||||
|
activity.startActivity(intent);
|
||||||
|
} else {
|
||||||
|
fragment.startActivity(intent);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> list(String... values) {
|
||||||
|
return Collections.unmodifiableList(Arrays.asList(values));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attachMoreExtras(Intent intent) {
|
||||||
|
for (Map.Entry<String,Object> entry : moreExtras.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
// Kind of hacky
|
||||||
|
if (value instanceof Integer) {
|
||||||
|
intent.putExtra(key, (Integer) value);
|
||||||
|
} else if (value instanceof Long) {
|
||||||
|
intent.putExtra(key, (Long) value);
|
||||||
|
} else if (value instanceof Boolean) {
|
||||||
|
intent.putExtra(key, (Boolean) value);
|
||||||
|
} else if (value instanceof Double) {
|
||||||
|
intent.putExtra(key, (Double) value);
|
||||||
|
} else if (value instanceof Float) {
|
||||||
|
intent.putExtra(key, (Float) value);
|
||||||
|
} else if (value instanceof Bundle) {
|
||||||
|
intent.putExtra(key, (Bundle) value);
|
||||||
|
} else {
|
||||||
|
intent.putExtra(key, value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 ZXing authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.zxing.integration.android;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.</p>
|
||||||
|
*
|
||||||
|
* @author Sean Owen
|
||||||
|
*/
|
||||||
|
public final class IntentResult {
|
||||||
|
|
||||||
|
private final String contents;
|
||||||
|
private final String formatName;
|
||||||
|
private final byte[] rawBytes;
|
||||||
|
private final Integer orientation;
|
||||||
|
private final String errorCorrectionLevel;
|
||||||
|
|
||||||
|
IntentResult() {
|
||||||
|
this(null, null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
IntentResult(String contents,
|
||||||
|
String formatName,
|
||||||
|
byte[] rawBytes,
|
||||||
|
Integer orientation,
|
||||||
|
String errorCorrectionLevel) {
|
||||||
|
this.contents = contents;
|
||||||
|
this.formatName = formatName;
|
||||||
|
this.rawBytes = rawBytes;
|
||||||
|
this.orientation = orientation;
|
||||||
|
this.errorCorrectionLevel = errorCorrectionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return raw content of barcode
|
||||||
|
*/
|
||||||
|
public String getContents() {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
|
||||||
|
*/
|
||||||
|
public String getFormatName() {
|
||||||
|
return formatName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return raw bytes of the barcode content, if applicable, or null otherwise
|
||||||
|
*/
|
||||||
|
public byte[] getRawBytes() {
|
||||||
|
return rawBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
|
||||||
|
*/
|
||||||
|
public Integer getOrientation() {
|
||||||
|
return orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the error correction level used in the barcode, if applicable
|
||||||
|
*/
|
||||||
|
public String getErrorCorrectionLevel() {
|
||||||
|
return errorCorrectionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder dialogText = new StringBuilder(100);
|
||||||
|
dialogText.append("Format: ").append(formatName).append('\n');
|
||||||
|
dialogText.append("Contents: ").append(contents).append('\n');
|
||||||
|
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
|
||||||
|
dialogText.append("Raw bytes: (").append(rawBytesLength).append(" bytes)\n");
|
||||||
|
dialogText.append("Orientation: ").append(orientation).append('\n');
|
||||||
|
dialogText.append("EC level: ").append(errorCorrectionLevel).append('\n');
|
||||||
|
return dialogText.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -44,14 +44,17 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
implementation fileTree(dir: 'libs', include: ['.so'])
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'org.torproject:tor-android-binary:0.4.4.6'
|
implementation 'org.torproject:tor-android-binary:0.4.4.6'
|
||||||
|
implementation 'info.pluggabletransports.aptds:apt-dispatch-library:1.0.9'
|
||||||
|
implementation 'info.pluggabletransports.aptds:apt-meek-obfs4-legacy:1.0.9'
|
||||||
|
implementation 'info.pluggabletransports.aptds:apt-dispatch-library:1.0.9'
|
||||||
|
implementation 'info.pluggabletransports.aptds:apt-meek-obfs4-legacy:1.0.9'
|
||||||
implementation 'info.pluggabletransports.aptds:jsocksAndroid:1.0.4'
|
implementation 'info.pluggabletransports.aptds:jsocksAndroid:1.0.4'
|
||||||
implementation 'com.jaredrummler:android-shell:1.0.0'
|
implementation 'com.jaredrummler:android-shell:1.0.0'
|
||||||
implementation 'androidx.core:core:1.3.2'
|
|
||||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
|
||||||
implementation 'com.offbynull.portmapper:portmapper:2.0.5'
|
implementation 'com.offbynull.portmapper:portmapper:2.0.5'
|
||||||
implementation 'info.guardianproject:jtorctl:0.4'
|
implementation 'info.guardianproject:jtorctl:0.4'
|
||||||
implementation 'com.github.tladesignz:IPtProxy:0.5.2'
|
implementation 'com.github.tladesignz:IPtProxy:0.5.2'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.torproject.android.service">
|
package="org.torproject.android.proxy">
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
snowflake https://d2kt284300pde7.cloudfront.net/
|
||||||
|
snowflake-stun stun:stun.l.google.com:19302
|
||||||
|
moat-cdn https://d50gd378qj74g.cloudfront.net/
|
||||||
|
moat-url https://moat.torproject.org.global.prod.fastly.net/
|
||||||
|
moat-front cdn.sstatic.net
|
|
@ -1,7 +1,7 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */
|
/* Copyright (c) 2009, Nathan Freitas, Orbot/The Guardian Project - http://openideals.com/guardian */
|
||||||
/* See LICENSE for licensing information */
|
/* See LICENSE for licensing information */
|
||||||
|
|
||||||
package org.torproject.android.service;
|
package org.torproject.android.proxy;
|
||||||
|
|
||||||
public interface OrbotConstants {
|
public interface OrbotConstants {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* Copyright (C) 2009-2010 Rodrigo Zechin Rosauro
|
* Copyright (C) 2009-2010 Rodrigo Zechin Rosauro
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.torproject.android.service;
|
package org.torproject.android.proxy;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
@ -48,17 +48,17 @@ import com.jaredrummler.android.shell.CommandResult;
|
||||||
import net.freehaven.tor.control.TorControlCommands;
|
import net.freehaven.tor.control.TorControlCommands;
|
||||||
import net.freehaven.tor.control.TorControlConnection;
|
import net.freehaven.tor.control.TorControlConnection;
|
||||||
|
|
||||||
import org.torproject.android.service.util.CustomShell;
|
import org.torproject.android.proxy.util.CustomShell;
|
||||||
import org.torproject.android.service.util.CustomTorResourceInstaller;
|
import org.torproject.android.proxy.util.CustomTorResourceInstaller;
|
||||||
import org.torproject.android.service.util.DummyActivity;
|
import org.torproject.android.proxy.util.DummyActivity;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
import org.torproject.android.service.util.TorServiceUtils;
|
import org.torproject.android.proxy.util.TorServiceUtils;
|
||||||
import org.torproject.android.service.util.Utils;
|
import org.torproject.android.proxy.util.Utils;
|
||||||
import org.torproject.android.service.vpn.OrbotVpnManager;
|
import org.torproject.android.proxy.vpn.OrbotVpnManager;
|
||||||
import org.torproject.android.service.vpn.VpnPrefs;
|
import org.torproject.android.proxy.vpn.VpnPrefs;
|
||||||
import org.torproject.android.service.wrapper.localHelperMethod;
|
import org.torproject.android.proxy.wrapper.localHelperMethod;
|
||||||
import org.torproject.android.service.wrapper.logRowModel;
|
import org.torproject.android.proxy.wrapper.logRowModel;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -73,6 +73,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -91,21 +93,22 @@ import java.util.concurrent.TimeoutException;
|
||||||
import IPtProxy.IPtProxy;
|
import IPtProxy.IPtProxy;
|
||||||
|
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
import static org.torproject.android.proxy.wrapper.orbotLocalConstants.mBridgesDefault;
|
||||||
|
|
||||||
public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants {
|
public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants {
|
||||||
|
|
||||||
public final static String BINARY_TOR_VERSION = org.torproject.android.binary.TorServiceConstants.BINARY_TOR_VERSION;
|
public final static String BINARY_TOR_VERSION = org.torproject.android.binary.TorServiceConstants.BINARY_TOR_VERSION;
|
||||||
static final int NOTIFY_ID = 1;
|
static final int NOTIFY_ID = 11;
|
||||||
private final static int CONTROL_SOCKET_TIMEOUT = 60000;
|
private final static int CONTROL_SOCKET_TIMEOUT = 60000;
|
||||||
private boolean mConnectivity = true;
|
private boolean mConnectivity = true;
|
||||||
private static final int ERROR_NOTIFY_ID = 3;
|
private static final int ERROR_NOTIFY_ID = 31;
|
||||||
private static final int HS_NOTIFY_ID = 4;
|
private static final int HS_NOTIFY_ID = 41;
|
||||||
private Notification mNotification;
|
private Notification mNotification;
|
||||||
private static final Uri V2_HS_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers/hs");
|
private static final Uri V2_HS_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers/hs");
|
||||||
private static final Uri V3_ONION_SERVICES_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice/v3");
|
private static final Uri V3_ONION_SERVICES_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice/v3");
|
||||||
private static final Uri COOKIE_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.cookie/cookie");
|
private static final Uri COOKIE_CONTENT_URI = Uri.parse("content://org.torproject.android.ui.hiddenservices.providers.cookie/cookie");
|
||||||
private static final Uri V3_CLIENT_AUTH_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.clientauth/v3auth");
|
private static final Uri V3_CLIENT_AUTH_URI = Uri.parse("content://org.torproject.android.ui.v3onionservice.clientauth/v3auth");
|
||||||
private final static String NOTIFICATION_CHANNEL_ID = "orbot_channel_1";
|
private final static String NOTIFICATION_CHANNEL_ID = "genesis_channel_1";
|
||||||
private static final String[] LEGACY_V2_ONION_SERVICE_PROJECTION = new String[]{
|
private static final String[] LEGACY_V2_ONION_SERVICE_PROJECTION = new String[]{
|
||||||
OnionService._ID,
|
OnionService._ID,
|
||||||
OnionService.NAME,
|
OnionService.NAME,
|
||||||
|
@ -234,6 +237,9 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
private void createNotificationChannel() {
|
private void createNotificationChannel() {
|
||||||
|
if(1==1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(orbotLocalConstants.mNotificationStatus==1) {
|
if(orbotLocalConstants.mNotificationStatus==1) {
|
||||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
|
@ -252,6 +258,9 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
|
|
||||||
@SuppressLint({"NewApi", "RestrictedApi"})
|
@SuppressLint({"NewApi", "RestrictedApi"})
|
||||||
protected void showToolbarNotification(String notifyMsg, int notifyType, int icon) {
|
protected void showToolbarNotification(String notifyMsg, int notifyType, int icon) {
|
||||||
|
if(1==1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
//if(orbotLocalConstants.mNotificationStatus==1){
|
//if(orbotLocalConstants.mNotificationStatus==1){
|
||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
Intent intent = pm.getLaunchIntentForPackage(getPackageName());
|
Intent intent = pm.getLaunchIntentForPackage(getPackageName());
|
||||||
|
@ -972,7 +981,12 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void exec(Runnable runn) {
|
protected void exec(Runnable runn) {
|
||||||
mExecutor.execute(runn);
|
try {
|
||||||
|
new Thread(runn).start();
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
Log.i("","");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int exec(String cmd, boolean wait) throws Exception {
|
private int exec(String cmd, boolean wait) throws Exception {
|
||||||
|
@ -1407,6 +1421,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
return extraLines;
|
return extraLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addV3OnionServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) {
|
private void addV3OnionServicesToTorrc(StringBuffer torrc, ContentResolver contentResolver) {
|
||||||
try {
|
try {
|
||||||
Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, V3_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null);
|
Cursor onionServices = contentResolver.query(V3_ONION_SERVICES_CONTENT_URI, V3_ONION_SERVICE_PROJECTION, OnionService.ENABLED + "=1", null, null);
|
||||||
|
@ -1620,7 +1635,8 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
alBridges = new ArrayList<>();
|
alBridges = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8"));
|
Reader inputString = new StringReader(mBridgesDefault);
|
||||||
|
BufferedReader in = new BufferedReader(inputString);
|
||||||
String str;
|
String str;
|
||||||
|
|
||||||
while ((str = in.readLine()) != null) {
|
while ((str = in.readLine()) != null) {
|
||||||
|
@ -1652,22 +1668,22 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
|
||||||
int maxBridges = 2;
|
int maxBridges = 2;
|
||||||
int bridgeCount = 0;
|
int bridgeCount = 0;
|
||||||
|
|
||||||
List<String> mList = Arrays.asList(orbotLocalConstants.mBridges.split("\n "));
|
|
||||||
|
|
||||||
if(orbotLocalConstants.mIsManualBridge){
|
if(orbotLocalConstants.mIsManualBridge){
|
||||||
|
List<String> mList = Arrays.asList(orbotLocalConstants.mBridges.split("\n "));
|
||||||
alBridges.clear();
|
alBridges.clear();
|
||||||
}
|
|
||||||
|
|
||||||
for(int e=0;e<mList.size();e++){
|
for(int e=0;e<mList.size();e++){
|
||||||
if(mList.get(e).length()<5){
|
if(mList.get(e).length()<5){
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
List<String> mListTemp = Arrays.asList(mList.get(e).split(" "));
|
||||||
|
int mIndex = 0;
|
||||||
|
while(mListTemp.get(mIndex).length()<3){
|
||||||
|
mIndex+=1;
|
||||||
|
}
|
||||||
|
alBridges.add(new Bridge(mList.get(e).replace(mListTemp.get(mIndex),"") , orbotLocalConstants.mManualBridgeType));
|
||||||
}
|
}
|
||||||
List<String> mListTemp = Arrays.asList(mList.get(e).split(" "));
|
|
||||||
int mIndex = 0;
|
|
||||||
while(mListTemp.get(mIndex).length()<3){
|
|
||||||
mIndex+=1;
|
|
||||||
}
|
|
||||||
alBridges.add(new Bridge(mList.get(e).replace(mListTemp.get(mIndex),"") , orbotLocalConstants.mManualBridgeType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Bridge b : alBridges) {
|
for (Bridge b : alBridges) {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service;
|
package org.torproject.android.proxy;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -6,7 +6,7 @@ import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
|
|
||||||
|
|
||||||
public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants {
|
public class StartTorReceiver extends BroadcastReceiver implements TorServiceConstants {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service;
|
package org.torproject.android.proxy;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
import net.freehaven.tor.control.EventHandler;
|
import net.freehaven.tor.control.EventHandler;
|
||||||
|
|
||||||
import org.torproject.android.service.util.ExternalIPFetcher;
|
import org.torproject.android.proxy.util.ExternalIPFetcher;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
|
@ -1,7 +1,7 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
||||||
/* See LICENSE for licensing information */
|
/* See LICENSE for licensing information */
|
||||||
|
|
||||||
package org.torproject.android.service;
|
package org.torproject.android.proxy;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
|
@ -1,9 +1,9 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.torproject.android.service.OrbotService;
|
import org.torproject.android.proxy.OrbotService;
|
||||||
import org.torproject.android.service.TorEventHandler;
|
import org.torproject.android.proxy.TorEventHandler;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import org.torproject.android.service.OrbotConstants;
|
import org.torproject.android.proxy.OrbotConstants;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
|
@ -1,8 +1,8 @@
|
||||||
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */
|
||||||
/* See LICENSE for licensing information */
|
/* See LICENSE for licensing information */
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
import org.torproject.android.proxy.TorServiceConstants;
|
||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
|
@ -2,7 +2,7 @@
|
||||||
/* See LICENSE for licensing information */
|
/* See LICENSE for licensing information */
|
||||||
|
|
||||||
|
|
||||||
package org.torproject.android.service.util;
|
package org.torproject.android.proxy.util;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.proxy.vpn;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
|
@ -27,20 +27,18 @@ import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.runjva.sourceforge.jsocks.protocol.ProxyServer;
|
import com.runjva.sourceforge.jsocks.protocol.ProxyServer;
|
||||||
import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone;
|
import com.runjva.sourceforge.jsocks.server.ServerAuthenticatorNone;
|
||||||
|
|
||||||
import org.torproject.android.service.OrbotConstants;
|
import org.torproject.android.proxy.OrbotConstants;
|
||||||
import org.torproject.android.service.OrbotService;
|
import org.torproject.android.proxy.OrbotService;
|
||||||
import org.torproject.android.service.R;
|
import org.torproject.android.proxy.R;
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
import org.torproject.android.proxy.TorServiceConstants;
|
||||||
import org.torproject.android.service.util.CustomNativeLoader;
|
import org.torproject.android.proxy.util.CustomNativeLoader;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -52,9 +50,9 @@ import java.net.InetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_START;
|
import static org.torproject.android.proxy.TorServiceConstants.ACTION_START;
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_START_VPN;
|
import static org.torproject.android.proxy.TorServiceConstants.ACTION_START_VPN;
|
||||||
import static org.torproject.android.service.TorServiceConstants.ACTION_STOP_VPN;
|
import static org.torproject.android.proxy.TorServiceConstants.ACTION_STOP_VPN;
|
||||||
|
|
||||||
public class OrbotVpnManager implements Handler.Callback {
|
public class OrbotVpnManager implements Handler.Callback {
|
||||||
private static final String TAG = "OrbotVpnService";
|
private static final String TAG = "OrbotVpnService";
|
||||||
|
@ -64,6 +62,7 @@ public class OrbotVpnManager implements Handler.Callback {
|
||||||
public static int sSocksProxyServerPort = -1;
|
public static int sSocksProxyServerPort = -1;
|
||||||
public static String sSocksProxyLocalhost = null;
|
public static String sSocksProxyLocalhost = null;
|
||||||
boolean isStarted = false;
|
boolean isStarted = false;
|
||||||
|
|
||||||
File filePdnsPid;
|
File filePdnsPid;
|
||||||
private Thread mThreadVPN;
|
private Thread mThreadVPN;
|
||||||
private final static String mSessionName = "OrbotVPN";
|
private final static String mSessionName = "OrbotVPN";
|
||||||
|
@ -259,13 +258,13 @@ public class OrbotVpnManager implements Handler.Callback {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String vpnName = "OrbotVPN";
|
final String vpnName = "GenesisVPN";
|
||||||
final String localhost = "127.0.0.1";
|
final String localhost = "127.0.0.1";
|
||||||
|
|
||||||
final String virtualGateway = "192.168.200.1";
|
final String virtualGateway = "10.10.10.1";
|
||||||
final String virtualIP = "192.168.200.2";
|
final String virtualIP = "10.10.10.2";
|
||||||
final String virtualNetMask = "255.255.255.0";
|
final String virtualNetMask = "255.255.255.0";
|
||||||
final String dummyDNS = "1.1.1.1"; //this is intercepted by the tun2socks library, but we must put in a valid DNS to start
|
final String dummyDNS = "8.8.8.8"; //this is intercepted by the tun2socks library, but we must put in a valid DNS to start
|
||||||
final String defaultRoute = "0.0.0.0";
|
final String defaultRoute = "0.0.0.0";
|
||||||
|
|
||||||
final String localSocks = localhost + ':' + mTorSocks;
|
final String localSocks = localhost + ':' + mTorSocks;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.proxy.vpn;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -15,7 +15,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import static org.torproject.android.service.vpn.VpnPrefs.PREFS_KEY_TORIFIED;
|
import static org.torproject.android.proxy.vpn.VpnPrefs.PREFS_KEY_TORIFIED;
|
||||||
|
|
||||||
public class TorifiedApp implements Comparable {
|
public class TorifiedApp implements Comparable {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.proxy.vpn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Psiphon Inc.
|
* Copyright (c) 2013, Psiphon Inc.
|
||||||
|
@ -26,7 +26,7 @@ import android.os.Build;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.torproject.android.service.util.TCPSourceApp;
|
import org.torproject.android.proxy.util.TCPSourceApp;
|
||||||
|
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.proxy.vpn;
|
||||||
|
|
||||||
public interface VpnPrefs {
|
public interface VpnPrefs {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.vpn;
|
package org.torproject.android.proxy.vpn;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package org.torproject.android.service.wrapper;
|
package org.torproject.android.proxy.wrapper;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import org.torproject.android.service.util.Prefs;
|
import org.torproject.android.proxy.util.Prefs;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.wrapper;
|
package org.torproject.android.proxy.wrapper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.service.wrapper;
|
package org.torproject.android.proxy.wrapper;
|
||||||
|
|
||||||
public class logRowModel {
|
public class logRowModel {
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
|
@ -1,21 +1,22 @@
|
||||||
package org.torproject.android.service.wrapper;
|
package org.torproject.android.proxy.wrapper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class orbotLocalConstants
|
public class orbotLocalConstants
|
||||||
{
|
{
|
||||||
public static ArrayList<logRowModel> mTorLogsHistory = new ArrayList<>();
|
public static ArrayList<logRowModel> mTorLogsHistory = new ArrayList<>();
|
||||||
public static String mTorLogsStatus = "Loading...";
|
public static String mTorLogsStatus = "Loading...";
|
||||||
public static boolean mIsTorInitialized = false;
|
public static boolean mIsTorInitialized = false;
|
||||||
public static int mNotificationStatus = 0;
|
public static int mNotificationStatus = 0;
|
||||||
public static WeakReference<Context> mHomeContext;
|
public static WeakReference<Context> mHomeContext;
|
||||||
public static Intent mHomeIntent = null;
|
public static Intent mHomeIntent = null;
|
||||||
public static String mBridges = "";
|
public static String mBridges = "";
|
||||||
public static boolean mIsManualBridge = false;
|
public static boolean mIsManualBridge = false;
|
||||||
public static String mManualBridgeType = "";
|
public static String mManualBridgeType = "";
|
||||||
public static boolean mNetworkState = true;
|
public static boolean mNetworkState = true;
|
||||||
}
|
public static String mBridgesDefault = "";
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue