mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,233 @@
|
|||
package org.acra.util;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ReportField;
|
||||
import org.acra.collector.CollectorUtil;
|
||||
import org.acra.collector.CrashReportData;
|
||||
import org.acra.sender.ReportSenderException;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.acra.ACRA.LOG_TAG;
|
||||
|
||||
public class JSONReportBuilder {
|
||||
/**
|
||||
* <p>
|
||||
* Create a JSONObject containing the whole report data with the most
|
||||
* detailed possible structure depth. Fields are not just converted to a
|
||||
* single key=value pair. If a value can be decomposed into subobjects, it
|
||||
* is done.
|
||||
* </p>
|
||||
* <p>
|
||||
* <p>
|
||||
* For example, a String containing:
|
||||
* <p>
|
||||
* <pre>
|
||||
* some.key.name1=value1
|
||||
* some.key.name2=value2
|
||||
* some.other=value3
|
||||
* any.other.key=value4
|
||||
* key.without.value5
|
||||
* </pre>
|
||||
* <p>
|
||||
* is converted to
|
||||
* <p>
|
||||
* <pre>
|
||||
* {
|
||||
* some : {
|
||||
* key : {
|
||||
* name1 : "value1",
|
||||
* name2 : "value2"
|
||||
* },
|
||||
* other : "value3"
|
||||
* },
|
||||
* any : {
|
||||
* other : {
|
||||
* key : "value4"
|
||||
* }
|
||||
* }
|
||||
* key.without.value : true
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @param errorContent The ACRA report data structure.
|
||||
* @return A JSONObject containing all fields from the report converted to
|
||||
* JSON.
|
||||
* @throws ReportSenderException
|
||||
* @throws JSONReportException
|
||||
*/
|
||||
public static JSONObject buildJSONReport(CrashReportData errorContent) throws JSONReportException {
|
||||
JSONObject jsonReport = new JSONObject();
|
||||
BufferedReader reader = null;
|
||||
for (ReportField key : errorContent.keySet()) {
|
||||
try {
|
||||
// Each ReportField can be identified as a substructure and not
|
||||
// a simple String value.
|
||||
if (key.containsKeyValuePairs()) {
|
||||
JSONObject subObject = new JSONObject();
|
||||
String strContent = errorContent.getProperty(key);
|
||||
reader = new BufferedReader(new StringReader(strContent), 1024);
|
||||
String line = null;
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
addJSONFromProperty(subObject, line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ACRA.log.e(LOG_TAG, "Error while converting " + key.name() + " to JSON.", e);
|
||||
}
|
||||
jsonReport.accumulate(key.name(), subObject);
|
||||
} else {
|
||||
// This field is a simple String value, store it as it is
|
||||
jsonReport.accumulate(key.name(), guessType(errorContent.getProperty(key)));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new JSONReportException("Could not create JSON object for key " + key, e);
|
||||
} finally {
|
||||
CollectorUtil.safeClose(reader);
|
||||
}
|
||||
}
|
||||
return jsonReport;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Given a String containing key=value pairs on each line, adds a detailed
|
||||
* JSON structure to an existing JSONObject, reusing intermediate subobjects
|
||||
* if available when keys are composed of a succession of subkeys delimited
|
||||
* by dots.
|
||||
* </p>
|
||||
* <p>
|
||||
* <p>
|
||||
* For example, adding the string "metrics.xdpi=160.0" to an object
|
||||
* containing
|
||||
* <p>
|
||||
* <pre>
|
||||
* {
|
||||
* "metrics" : { "ydpi" : "160.0"},
|
||||
* "width" : "320",
|
||||
* "height" : "533"
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* results in
|
||||
* <p>
|
||||
* <pre>
|
||||
* {
|
||||
* "metrics" : { "ydpi" : "160.0", "xdpi" : "160.0"},
|
||||
* "width" : "320",
|
||||
* "height" : "533"
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* @param destination The JSONObject where the data must be inserted.
|
||||
* @param propertyString A string containing "some.key.name=Any value"
|
||||
* @throws JSONException
|
||||
*/
|
||||
private static void addJSONFromProperty(JSONObject destination, String propertyString) throws JSONException {
|
||||
int equalsIndex = propertyString.indexOf('=');
|
||||
if (equalsIndex > 0) {
|
||||
JSONObject finalObject = destination;
|
||||
String currentKey = propertyString.substring(0, equalsIndex).trim();
|
||||
String currentValue = propertyString.substring(equalsIndex + 1).trim();
|
||||
Object value = guessType(currentValue);
|
||||
if (value instanceof String) {
|
||||
value = ((String) value).replaceAll("\\\\n", "\n");
|
||||
}
|
||||
String[] splitKey = currentKey.split("\\.");
|
||||
if (splitKey.length > 1) {
|
||||
addJSONSubTree(finalObject, splitKey, value);
|
||||
} else {
|
||||
finalObject.accumulate(currentKey, value);
|
||||
}
|
||||
} else {
|
||||
destination.put(propertyString.trim(), true);
|
||||
}
|
||||
}
|
||||
|
||||
private static Object guessType(String value) {
|
||||
if (value.equalsIgnoreCase("true"))
|
||||
return true;
|
||||
if (value.equalsIgnoreCase("false"))
|
||||
return false;
|
||||
|
||||
if (value.matches("(?:^|\\s)([1-9](?:\\d*|(?:\\d{0,2})(?:,\\d{3})*)(?:\\.\\d*[1-9])?|0?\\.\\d*[1-9]|0)(?:\\s|$)")) {
|
||||
NumberFormat format = NumberFormat.getInstance(Locale.US);
|
||||
try {
|
||||
Number number = format.parse(value);
|
||||
return number;
|
||||
} catch (ParseException e) {
|
||||
// never mind
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deep insert a value inside a JSONObject, reusing existing subobjects when
|
||||
* available or creating them when necessary.
|
||||
*
|
||||
* @param destination The JSONObject which receives the additional subitem.
|
||||
* @param keys An array containing the path keys leading to where the value
|
||||
* has to be inserted.
|
||||
* @param value The value to be inserted.
|
||||
* @throws JSONException
|
||||
*/
|
||||
private static void addJSONSubTree(JSONObject destination, String[] keys, Object value) throws JSONException {
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
String subKey = keys[i];
|
||||
if (i < keys.length - 1) {
|
||||
JSONObject intermediate = null;
|
||||
if (destination.isNull(subKey)) {
|
||||
intermediate = new JSONObject();
|
||||
destination.accumulate(subKey, intermediate);
|
||||
} else {
|
||||
Object target = destination.get(subKey);
|
||||
if (target instanceof JSONObject) {
|
||||
intermediate = destination.getJSONObject(subKey);
|
||||
} else if (target instanceof JSONArray) {
|
||||
// Unexpected JSONArray, see issue #186
|
||||
JSONArray wildCard = destination.getJSONArray(subKey);
|
||||
for (int j = 0; j < wildCard.length(); j++) {
|
||||
intermediate = wildCard.optJSONObject(j);
|
||||
if (intermediate != null) {
|
||||
// Found the original JSONObject we were looking for
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intermediate == null) {
|
||||
ACRA.log.e(LOG_TAG, "Unknown json subtree type, see issue #186");
|
||||
// We should never get here, but if we do, drop this value to still send the report
|
||||
return;
|
||||
}
|
||||
}
|
||||
destination = intermediate;
|
||||
} else {
|
||||
destination.accumulate(subKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class JSONReportException extends Exception {
|
||||
private static final long serialVersionUID = -694684023635442219L;
|
||||
|
||||
public JSONReportException(String message, Throwable e) {
|
||||
super(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.adins.mss.base.commons;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Helper {
|
||||
|
||||
public static Helper getInstance(){
|
||||
return new Helper();
|
||||
}
|
||||
|
||||
//Method for read developer options state
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public static boolean isDevEnabled(Context context) {
|
||||
int mode = 0;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
mode = Settings.Secure.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
} else {
|
||||
mode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||
}
|
||||
|
||||
return mode == 1;
|
||||
}
|
||||
|
||||
public static void requestAutostartService(Context context) {
|
||||
|
||||
SharedPreferences securityPrefsPrefs = context.getSharedPreferences(context.getString(R.string.security_prefs), Context.MODE_PRIVATE);
|
||||
if (securityPrefsPrefs.contains("autostart") && securityPrefsPrefs.getBoolean("autostart", false)) return;
|
||||
|
||||
Intent intent = new Intent();
|
||||
String manufacture = Build.MANUFACTURER.toLowerCase();
|
||||
|
||||
switch (manufacture) {
|
||||
case "xiaomi":
|
||||
intent.setComponent(new ComponentName("com.miui.securitycenter",
|
||||
"com.miui.permcenter.autostart.AutoStartManagementActivity"));
|
||||
break;
|
||||
case "oppo":
|
||||
intent.setComponent(new ComponentName("com.coloros.safecenter",
|
||||
"com.coloros.safecenter.permission.startup.StartupAppListActivity"));
|
||||
|
||||
break;
|
||||
case "vivo":
|
||||
intent.setComponent(new ComponentName("com.vivo.permissionmanager",
|
||||
"com.vivo.permissionmanager.activity.BgStartUpManagerActivity"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
List<ResolveInfo> arrayList = context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
|
||||
if (arrayList.size() > 0) {
|
||||
securityPrefsPrefs.edit().putBoolean("autostart", true).apply();
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.adins.mss.foundation.dialog.gitonway.lib.effects;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.adins.libs.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
/*
|
||||
* Copyright 2014 litao
|
||||
* https://github.com/sd6352051/NiftyDialogEffects
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
public class FadeIn extends BaseEffects {
|
||||
|
||||
@Override
|
||||
protected void setupAnimation(View view) {
|
||||
getAnimatorSet().playTogether(
|
||||
ObjectAnimator.ofFloat(view, "alpha", 0, 1).setDuration(mDuration)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/fontColorWhite"
|
||||
android:pathData="M20,6h-4L16,4c0,-1.11 -0.89,-2 -2,-2h-4c-1.11,0 -2,0.89 -2,2v2L4,6c-1.11,0 -1.99,0.89 -1.99,2L2,19c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM14,6h-4L10,4h4v2z"/>
|
||||
</vector>
|
|
@ -0,0 +1,32 @@
|
|||
package com.adins.mss.foundation.dialog.gitonway.lib.effects;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.adins.libs.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
/*
|
||||
* Copyright 2014 litao
|
||||
* https://github.com/sd6352051/NiftyDialogEffects
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
public class FlipH extends BaseEffects {
|
||||
|
||||
@Override
|
||||
protected void setupAnimation(View view) {
|
||||
getAnimatorSet().playTogether(
|
||||
ObjectAnimator.ofFloat(view, "rotationY", -90, 0).setDuration(mDuration)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bgColor">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bgColorWhite">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
</LinearLayout>
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="@color/gradient_end"
|
||||
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
|
||||
</vector>
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
* This class was copied from this blog post:
|
||||
* http://blog.dev001.net/post/67082904181/android-using-sni-and-tlsv1-2-with-apache-httpclient
|
||||
* Thanks go to Dev001!
|
||||
* Also, changes for using only secure cipher suites were included from code of DAVdroid.
|
||||
* Thankgs go to Ricki Hirner (bitfire web engineering)!
|
||||
*/
|
||||
package org.acra.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.net.SSLCertificateSocketFactory;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.apache.http.conn.scheme.LayeredSocketFactory;
|
||||
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLPeerUnverifiedException;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
|
||||
/**
|
||||
* Provides a SSLSocketFactory that is able to use SNI for SSL connections and
|
||||
* therefore allows multiple SSL servers on one IP address.<br/>
|
||||
* 1) socket = createSocket() is called
|
||||
* 2) reasonable encryption settings are applied to socket
|
||||
* 3) SNI is set up for socket
|
||||
* 4) handshake and certificate/host name verification
|
||||
* <p/>
|
||||
*
|
||||
* @author Philipp Kapfer
|
||||
* @since 4.6.0
|
||||
*/
|
||||
public class TlsSniSocketFactory implements LayeredSocketFactory {
|
||||
|
||||
private static final String TAG = TlsSniSocketFactory.class.getSimpleName();
|
||||
|
||||
private final static int VERSION_CODES_JELLY_BEAN_MR1 = 17;
|
||||
private final static int VERSION_CODES_LOLLIPOP = 21;
|
||||
// use BrowserCompatHostnameVerifier to allow IP addresses in the Common Name
|
||||
private final static HostnameVerifier hostnameVerifier = new BrowserCompatHostnameVerifier();
|
||||
private static final List<String> ALLOWED_CIPHERS = Arrays.asList(
|
||||
// allowed secure ciphers according to NIST.SP.800-52r1.pdf Section 3.3.1 (see http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r1.pdf)
|
||||
// TLS 1.2
|
||||
"TLS_RSA_WITH_AES_256_GCM_SHA384",
|
||||
"TLS_RSA_WITH_AES_128_GCM_SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
||||
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
|
||||
"TLS_ECHDE_RSA_WITH_AES_128_GCM_SHA256",
|
||||
// maximum interoperability
|
||||
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
|
||||
"TLS_RSA_WITH_AES_128_CBC_SHA",
|
||||
// additionally
|
||||
"TLS_RSA_WITH_AES_256_CBC_SHA",
|
||||
"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
|
||||
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
|
||||
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
|
||||
);
|
||||
private final SSLCertificateSocketFactory sslSocketFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory.getDefault(0);
|
||||
|
||||
// Plain TCP/IP (layer below TLS)
|
||||
|
||||
@Override
|
||||
public Socket connectSocket(Socket s, String host, int port, InetAddress localAddress, int localPort, HttpParams params) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket() throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure(Socket s) throws IllegalArgumentException {
|
||||
return (s instanceof SSLSocket) && s.isConnected();
|
||||
}
|
||||
|
||||
|
||||
// TLS layer
|
||||
|
||||
@Override
|
||||
public Socket createSocket(Socket plainSocket, String host, int port, boolean autoClose) throws IOException {
|
||||
if (autoClose) {
|
||||
// we don't need the plainSocket
|
||||
plainSocket.close();
|
||||
}
|
||||
|
||||
// create and connect SSL socket, but don't do hostname/certificate verification yet
|
||||
final SSLSocket ssl = (SSLSocket) sslSocketFactory.createSocket(InetAddress.getByName(host), port);
|
||||
|
||||
// establish and verify TLS connection
|
||||
establishAndVerify(ssl, host);
|
||||
|
||||
return ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes and verifies a TLS connection to a (TCP-)connected SSLSocket:
|
||||
* - set TLS parameters like allowed protocols and ciphers
|
||||
* - set SNI host name
|
||||
* - verify host name
|
||||
* - verify certificate
|
||||
*
|
||||
* @param socket unconnected SSLSocket
|
||||
* @param host host name for SNI
|
||||
* @throws IOException if the connection could not be established.
|
||||
*/
|
||||
private void establishAndVerify(SSLSocket socket, String host) throws IOException {
|
||||
setTlsParameters(socket);
|
||||
setSniHostname(socket, host);
|
||||
|
||||
// TLS handshake, throws an exception for untrusted certificates
|
||||
socket.startHandshake();
|
||||
|
||||
// verify hostname and certificate
|
||||
SSLSession session = socket.getSession();
|
||||
if (!hostnameVerifier.verify(host, session)) {
|
||||
// throw exception for invalid host names
|
||||
throw new SSLPeerUnverifiedException(host);
|
||||
}
|
||||
|
||||
ACRA.log.i(TAG, "Established " + session.getProtocol() + " connection with " + session.getPeerHost() + " using " + session.getCipherSuite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a TLS/SSL connection socket by:
|
||||
* - setting reasonable TLS protocol versions
|
||||
* - setting reasonable cipher suites (if required)
|
||||
*
|
||||
* @param socket unconnected SSLSocket to prepare
|
||||
*/
|
||||
private void setTlsParameters(SSLSocket socket) {
|
||||
// Android 5.0+ (API level21) provides reasonable default settings
|
||||
// but it still allows SSLv3
|
||||
// https://developer.android.com/about/versions/android-5.0-changes.html#ssl
|
||||
|
||||
/* set reasonable protocol versions */
|
||||
// - enable all supported protocols (enables TLSv1.1 and TLSv1.2 on Android <5.0)
|
||||
// - remove all SSL versions (especially SSLv3) because they're insecure now
|
||||
final List<String> protocols = new LinkedList<String>();
|
||||
for (String protocol : socket.getSupportedProtocols()) {
|
||||
if (!protocol.toUpperCase().contains("SSL")) {
|
||||
protocols.add(protocol);
|
||||
}
|
||||
}
|
||||
ACRA.log.v(TAG, "Setting allowed TLS protocols: " + TextUtils.join(", ", protocols));
|
||||
socket.setEnabledProtocols(protocols.toArray(new String[protocols.size()]));
|
||||
|
||||
/* set reasonable cipher suites */
|
||||
if (Build.VERSION.SDK_INT < VERSION_CODES_LOLLIPOP) {
|
||||
// choose secure cipher suites
|
||||
|
||||
final List<String> availableCiphers = Arrays.asList(socket.getSupportedCipherSuites());
|
||||
|
||||
// preferred ciphers = allowed Ciphers \ availableCiphers
|
||||
final Set<String> preferredCiphers = new HashSet<String>(ALLOWED_CIPHERS);
|
||||
preferredCiphers.retainAll(availableCiphers);
|
||||
|
||||
// add enabled ciphers to preferred ciphers
|
||||
// for maximum security, preferred ciphers should *replace* enabled ciphers,
|
||||
// but for the security level of ACRA, disabling of insecure
|
||||
// ciphers should be a server-side task
|
||||
preferredCiphers.addAll(Arrays.asList(socket.getEnabledCipherSuites()));
|
||||
|
||||
ACRA.log.v(TAG, "Setting allowed TLS ciphers: " + TextUtils.join(", ", preferredCiphers));
|
||||
socket.setEnabledCipherSuites(preferredCiphers.toArray(new String[preferredCiphers.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES_JELLY_BEAN_MR1)
|
||||
private void setSniHostname(SSLSocket socket, String hostName) {
|
||||
// set SNI host name
|
||||
if (Build.VERSION.SDK_INT >= VERSION_CODES_JELLY_BEAN_MR1) {
|
||||
ACRA.log.d(TAG, "Using documented SNI with host name " + hostName);
|
||||
sslSocketFactory.setHostname(socket, hostName);
|
||||
} else {
|
||||
ACRA.log.d(TAG, "No documented SNI support on Android <4.2, trying reflection method with host name " + hostName);
|
||||
try {
|
||||
final Method setHostnameMethod = socket.getClass().getMethod("setHostname", String.class);
|
||||
setHostnameMethod.invoke(socket, hostName);
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
ACRA.log.w(TAG, "SNI not usable", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
|
@ -0,0 +1,11 @@
|
|||
package com.adins.mss.base.personalization;
|
||||
|
||||
public class PersonalizationResult {
|
||||
|
||||
private boolean success;
|
||||
private String errorMessage;
|
||||
|
||||
public PersonalizationResult() {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="#000"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:background="@drawable/activated_background_indicator"
|
||||
android:minHeight="42dp"/>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,217 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.adins.mss.odr"
|
||||
android:installLocation="internalOnly">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<!-- External storage for caching. -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<!-- My Location -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true"/>
|
||||
|
||||
<application
|
||||
android:supportsRtl="true"
|
||||
android:name="com.adins.mss.main.MSMApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon_launcher_lead_in"
|
||||
android:logo="@drawable/logo_mss"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/CustomTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
<service
|
||||
android:name="com.services.MOApplicationRunningService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver android:name="com.services.MOApplicationRunningService$UserLogoutReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.adins.mss.action_USER_LOGOUT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name=".MOLoginActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.base.ServerLinkActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_server_link"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.DeveloperOptionActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_developer_option"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".MOSynchronizeActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".NewMOMainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".news.NewsChildActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/CustomTheme"></activity>
|
||||
<activity
|
||||
android:name=".news.NewsContentActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name=".accounts.AccountsListActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".accounts.AccountResultActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name=".accounts.OpportunityDetailActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/title_mn_account"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.image.ViewImageActivity"
|
||||
android:launchMode="singleTop" />
|
||||
<activity android:name="com.soundcloud.android.crop.CropImageActivity" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.timeline.comment.activity.CommentActivity"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.dynamicform.DynamicFormActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:parentActivityName=".NewMOMainActivity"
|
||||
android:screenOrientation="portrait">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".NewMOMainActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.ResultOrderActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.update.ResultUpdateActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.odr.update.OrderCancelActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"></activity>
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.camerainapp.CameraActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/CustomTheme" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.timeline.MapsViewer"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.ChangePasswordActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
|
||||
android:launchMode="singleTop" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.image.CroppingImageActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity android:name="com.adins.mss.base.PrintActivity" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.todolist.form.ViewMapActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.questiongenerator.form.LocationTagingView"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.foundation.questiongenerator.form.FingerDrawingActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
<activity
|
||||
android:name="com.adins.mss.base.todolist.form.AllHeaderViewerActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|screenSize" />
|
||||
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
android:value="false" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.maps.v2.API_KEY"
|
||||
android:value="AIzaSyA2V50uQBKw5_w2f3BEEbcNkmwofZyt-Io" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<service android:name="com.tracking.LocationTrackingService" />
|
||||
<service android:name="com.services.AutoSendImageService" />
|
||||
<service android:name="com.services.AutoSendTaskService" />
|
||||
<service android:name="com.services.NotificationService" />
|
||||
|
||||
<service android:name="com.services.FirebaseMessagingService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name="com.services.RefreshToken">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/new_btn_press_color" />
|
||||
<corners
|
||||
android:radius="4dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<solid
|
||||
android:color="@color/new_btn_unpress_color" />
|
||||
<corners
|
||||
android:radius="4dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
Loading…
Add table
Add a link
Reference in a new issue