liuzhenxing1118 3 年之前
父節點
當前提交
5551ece2c8

+ 1 - 0
.idea/misc.xml

@@ -8,6 +8,7 @@
         <entry key="app/src/main/res/drawable/view_shape.xml" value="0.112" />
         <entry key="app/src/main/res/drawable/xp_checkbox.xml" value="0.112" />
         <entry key="app/src/main/res/layout/activity_apn_delete.xml" value="0.19300911854103345" />
+        <entry key="app/src/main/res/layout/activity_blackdoor_password.xml" value="0.3695652173913043" />
         <entry key="app/src/main/res/layout/activity_change_progress.xml" value="0.1" />
         <entry key="app/src/main/res/layout/activity_display.xml" value="0.11610486891385768" />
         <entry key="app/src/main/res/layout/activity_list.xml" value="0.19300911854103345" />

+ 4 - 0
app/src/main/AndroidManifest.xml

@@ -174,6 +174,10 @@
             android:name=".Activity.SourceAnnouncementActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="singleInstance" />
+        <activity
+            android:name=".Activity.BlackDoorPasswordActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:launchMode="singleInstance" />
     </application>
 
 </manifest>

+ 16 - 0
app/src/main/java/com/xplora/xpsettings/Activity/AboutActivity.java

@@ -31,6 +31,8 @@ import java.util.List;
 
 public class AboutActivity extends BaseActivity {
 
+    private int mClickCount = 0;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -77,6 +79,12 @@ public class AboutActivity extends BaseActivity {
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 if (position == mDataList.size()-1) {
                     openSourceAnnouncement();
+                } else if (position == 4) {
+                    mClickCount++;
+                    if (mClickCount >= 7) {
+                        mClickCount = 0;
+                        showBlackdoorPassword();
+                    }
                 }
             }
         });
@@ -112,6 +120,14 @@ public class AboutActivity extends BaseActivity {
         return Formatter.formatFileSize(context, initial_memory);// Byte转换为KB或者MB,内存大小规格化
     }
 
+    private void showBlackdoorPassword() {
+        if (DataManager.getIsDebugable()) {
+            Intent intent = new Intent(this, BlackDoorPasswordActivity.class);
+            startActivity(intent);
+            DataManager.setIsDebugable(false);
+        }
+    }
+
     private void openSourceAnnouncement() {
         Intent intent = new Intent(this, SourceAnnouncementActivity.class);
         startActivity(intent);

+ 116 - 0
app/src/main/java/com/xplora/xpsettings/Activity/BlackDoorPasswordActivity.java

@@ -0,0 +1,116 @@
+package com.xplora.xpsettings.Activity;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.core.app.ActivityCompat;
+
+import com.android.internal.telephony.ITelephony;
+import com.xplora.xpsettings.R;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+public class BlackDoorPasswordActivity extends BaseActivity {
+    public String mInput = "";
+    private TextView mTextView1 = null;
+    private TextView mTextView2 = null;
+    private TextView mTextView3 = null;
+    private TextView mTextView4 = null;
+
+    private int subID = 0;
+    private final String TAG = getClass().getSimpleName();
+
+    private String mSavePin = "";
+    private int mPinOrPuk = 1;  //1:pin 2:puk
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_blackdoor_password);
+        mTextView1 = findViewById(R.id.text1);
+        mTextView2 = findViewById(R.id.text2);
+        mTextView3 = findViewById(R.id.text3);
+        mTextView4 = findViewById(R.id.text4);
+
+        Button button1 = findViewById(R.id.button1);
+        Button button2 = findViewById(R.id.button2);
+        Button button3 = findViewById(R.id.button3);
+        Button button4 = findViewById(R.id.button4);
+        Button button5 = findViewById(R.id.button5);
+        Button button6 = findViewById(R.id.button6);
+        Button button7 = findViewById(R.id.button7);
+        Button button8 = findViewById(R.id.button8);
+        Button button9 = findViewById(R.id.button9);
+        Button button0 = findViewById(R.id.button0);
+        Button buttonOK = findViewById(R.id.buttonOK);
+        ImageButton buttonBack = findViewById(R.id.buttonBack);
+
+        button1.setOnClickListener(mOnClickListener);
+        button2.setOnClickListener(mOnClickListener);
+        button3.setOnClickListener(mOnClickListener);
+        button4.setOnClickListener(mOnClickListener);
+        button5.setOnClickListener(mOnClickListener);
+        button6.setOnClickListener(mOnClickListener);
+        button7.setOnClickListener(mOnClickListener);
+        button8.setOnClickListener(mOnClickListener);
+        button9.setOnClickListener(mOnClickListener);
+        button0.setOnClickListener(mOnClickListener);
+        buttonOK.setOnClickListener(mOnClickListener);
+        buttonBack.setOnClickListener(mOnClickListener);
+    }
+
+    View.OnClickListener mOnClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            int tag = Integer.parseInt((String) v.getTag());
+            if (tag == 100) {
+                actionBack();
+            } else if (tag == 101) {
+                actionOK();
+            } else {
+                if (mInput.length() >= 4)
+                    return;
+                mInput += tag;
+                showPinCode();
+            }
+        }
+    };
+
+    private void showPinCode() {
+        mTextView1.setText(mInput.length() >= 1 ? String.valueOf(mInput.charAt(0)) : "");
+        mTextView2.setText(mInput.length() >= 2 ? String.valueOf(mInput.charAt(1)) : "");
+        mTextView3.setText(mInput.length() >= 3 ? String.valueOf(mInput.charAt(2)) : "");
+        mTextView4.setText(mInput.length() >= 4 ? String.valueOf(mInput.charAt(3)) : "");
+    }
+
+    private void actionBack() {
+        if (mInput.length() <= 0)
+            return;
+        mInput = mInput.substring(0, mInput.length() - 1);
+        showPinCode();
+    }
+
+    private void actionOK() {
+        if (!mInput.equals("1123")) {
+            Toast toast =  Toast.makeText(this, getString(R.string.blackdoor_password_error), Toast.LENGTH_SHORT);
+            toast.show();
+        } else{
+            Intent intent = new Intent(BlackDoorPasswordActivity.this, TestToolsActivity.class);
+            startActivity(intent);
+        }
+    }
+}

+ 6 - 6
app/src/main/java/com/xplora/xpsettings/Activity/TestToolsActivity.java

@@ -9,6 +9,7 @@ import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 //import android.os.SystemProperties;
+import android.os.SystemProperties;
 import android.util.Log;
 import android.widget.ListView;
 
@@ -50,12 +51,10 @@ public class TestToolsActivity extends BaseActivity {
             model.value = "";
             model.isShowArrow = true;
             if(model.title.equals("loggable")) {
-                //model.isOn = Objects.equals(SystemProperties.get("persist.sys.offlinelog", "1"), "1");
-                model.isOn = Objects.equals("1", "1");
+                model.isOn = Objects.equals(SystemProperties.get("persist.sys.offlinelog", "1"), "1");
             }
             if(model.title.equals("Debugable")) {
-//                String usbConfig = SystemProperties.get("sys.usb.config",  DEBUG_OFF);
-                String usbConfig = "1";
+                String usbConfig = SystemProperties.get("sys.usb.config",  DEBUG_OFF);
                 model.isOn = Objects.equals(usbConfig,  DEBUG_ON);
             }
             mDataList.add(model);
@@ -94,12 +93,13 @@ public class TestToolsActivity extends BaseActivity {
             }
         });
     }
+
     private void onOffLog(int isOn) {
-        //SystemProperties.set("persist.sys.offlinelog", String.valueOf(isOn));
+        SystemProperties.set("persist.sys.offlinelog", String.valueOf(isOn));
     }
 
     private void onOffDebug(boolean isOn) {
-        //SystemProperties.set("sys.usb.config", isOn ? DEBUG_ON : DEBUG_OFF);
+        SystemProperties.set("sys.usb.config", isOn ? DEBUG_ON : DEBUG_OFF);
     }
 
     Handler handler = new Handler(Looper.myLooper()) {

+ 0 - 2
app/src/main/java/com/xplora/xpsettings/Adapter/BaseListAdapter.java

@@ -17,8 +17,6 @@ import android.widget.ImageView;
 import android.widget.Switch;
 import android.widget.TextView;
 
-import com.xplora.xpsettings.Activity.TestToolsActivity;
-import com.xplora.xpsettings.Activity.WiFiActivity;
 import com.xplora.xpsettings.IconProgressView;
 import com.xplora.xpsettings.Model.BaseModel;
 import com.xplora.xpsettings.Model.IconProgressModel;

+ 0 - 2
app/src/main/java/com/xplora/xpsettings/Adapter/ConnectionsAdapter.java

@@ -13,8 +13,6 @@ import android.widget.ImageView;
 import android.widget.Switch;
 import android.widget.TextView;
 
-import com.xplora.xpsettings.Activity.TestToolsActivity;
-import com.xplora.xpsettings.Activity.WiFiActivity;
 import com.xplora.xpsettings.Model.BaseModel;
 import com.xplora.xpsettings.R;
 import com.xplora.xpsettings.Utils.ResUtils;

+ 0 - 1
app/src/main/java/com/xplora/xpsettings/Adapter/ListAdapter.java

@@ -13,7 +13,6 @@ import android.widget.Switch;
 import android.widget.TextView;
 
 import com.xplora.xpsettings.Activity.TestToolsActivity;
-import com.xplora.xpsettings.Activity.WiFiActivity;
 import com.xplora.xpsettings.Model.BaseModel;
 import com.xplora.xpsettings.R;
 

+ 9 - 1
app/src/main/java/com/xplora/xpsettings/Data/DataManager.java

@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 public class DataManager extends Application {
     public String TAG = "losion :" + getClass().getSimpleName();
     private static Context sContext;
+    private static boolean isDebugable = true;
     public static final String socketAction = "com.xplora.localsocket";
     public static final short ACTION_SCREEN_TIME_CHANGED = 0x01;
     public static final short ACTION_BRIGHTNESS_CHANGED = 0x02;
@@ -45,7 +46,6 @@ public class DataManager extends Application {
     public static String mPhotoResolution;
     public static String mVideoResolution;
 
-
     @Override
     public void onCreate() {
         super.onCreate();
@@ -366,4 +366,12 @@ public class DataManager extends Application {
             return SystemProperties.get("persist.zs.wifi.address", "");
         }
     }
+
+    public static boolean getIsDebugable() {
+        return isDebugable;
+    }
+
+    public static void setIsDebugable(boolean debugable) {
+        isDebugable = debugable;
+    }
 }

二進制
app/src/main/res/drawable-xhdpi/pin_delete.png


+ 235 - 0
app/src/main/res/layout/activity_blackdoor_password.xml

@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@color/black"
+    android:layout_marginStart="20dp"
+    android:layout_marginEnd="20dp"
+    >
+
+    <LinearLayout
+        android:id="@+id/mEditLayout"
+        android:layout_width="match_parent"
+        android:layout_height="32dp"
+        android:layout_marginTop="34dp"
+        android:orientation="horizontal"
+        android:layout_marginStart="10dp"
+        android:layout_marginEnd="10dp"
+        >
+        <TextView
+            android:id="@+id/text1"
+            android:layout_width="30dp"
+            android:layout_height="match_parent"
+            android:background="#262626"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:textFontWeight="600"
+            android:textColor="@color/white"
+            android:textSize="18sp"
+            />
+        <TextView
+            android:id="@+id/text2"
+            android:layout_width="30dp"
+            android:layout_height="match_parent"
+            android:layout_marginStart="2dp"
+            android:background="#262626"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:textFontWeight="600"
+            android:textColor="@color/white"
+            android:textSize="18sp"
+            />
+        <TextView
+            android:id="@+id/text3"
+            android:layout_width="30dp"
+            android:layout_height="match_parent"
+            android:layout_marginStart="2dp"
+            android:background="#262626"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:textFontWeight="600"
+            android:textColor="@color/white"
+            android:textSize="18sp"
+            />
+        <TextView
+            android:id="@+id/text4"
+            android:layout_width="30dp"
+            android:layout_height="match_parent"
+            android:layout_marginStart="2dp"
+            android:background="#262626"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:textFontWeight="600"
+            android:textColor="@color/white"
+            android:textSize="18sp"
+            />
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/mLine1Layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp"
+        android:orientation="horizontal"
+        android:layout_weight="1"
+        >
+        <Button
+            android:id="@+id/button1"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="1"
+            android:tag="1" />
+        <Button
+            android:id="@+id/button2"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="2"
+            android:tag="2" />
+        <Button
+            android:id="@+id/button3"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="3"
+            android:tag="3" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/mLine2Layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_weight="1"
+        >
+        <Button
+            android:id="@+id/button4"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="4"
+            android:tag="4" />
+        <Button
+            android:id="@+id/button5"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="5"
+            android:tag="5" />
+        <Button
+            android:id="@+id/button6"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="6"
+            android:tag="6" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/mLine3Layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_weight="1"
+        >
+        <Button
+            android:id="@+id/button7"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="7"
+            android:tag="7" />
+        <Button
+            android:id="@+id/button8"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="8"
+            android:tag="8" />
+        <Button
+            android:id="@+id/button9"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="9"
+            android:tag="9" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/mLine4Layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_weight="1"
+        android:layout_marginBottom="10dp"
+        >
+        <ImageButton
+            android:id="@+id/buttonBack"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:backgroundTint="@color/transparent"
+            android:src="@drawable/pin_delete"
+            android:layout_weight="1"
+            android:tag="100" />
+        <Button
+            android:id="@+id/button0"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:textColor="#FBD460"
+            android:text="0"
+            android:tag="0" />
+        <Button
+            android:id="@+id/buttonOK"
+            android:layout_width="50dp"
+            android:layout_height="wrap_content"
+            android:background="@color/transparent"
+            android:layout_weight="1"
+            android:textFontWeight="800"
+            android:textSize="12sp"
+            android:text="OK"
+            android:tag="101" />
+    </LinearLayout>
+
+</LinearLayout>

+ 1 - 0
app/src/main/res/values/colors.xml

@@ -9,4 +9,5 @@
     <color name="white">#FFFFFFFF</color>
     <color name="xp_yellow">#FFFFC34B</color>
     <color name="blue">#2D74FF</color>
+    <color name="transparent">#00FFFFFF</color>
 </resources>

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -45,6 +45,9 @@
     <string name="confirm_to_restart">Confirm to restart?</string>
     <string name="confirm_to_shut_down">Confirm to shut down?</string>
 
+    <string name="blackdoor_password_error">Wrong password!</string>
+
     <string name="source_announcement_1">The software included in this product contains copyrighted software that is licensed under the GPL.</string>
     <string name="source_announcement_2">If you would like to obtain the complete corresponding source code for a period of two years after the last shipment of this product by sending an email to support@xplora.com</string>
+
 </resources>