IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 移动开发 -> 设置密码补丁 -> 正文阅读

[移动开发]设置密码补丁


Subject: [PATCH] add recovery password dialog

---
?.../Settings/res/layout/PwdDialog.xml ? ? ? ? | 32 +++++++++++++
?.../Settings/res/values/strings_hi.xml ? ? ? ?| ?3 ++
?.../com/android/tv/settings/MainFragment.java | ?1 +
?.../device/storage/ResetActivity.java ? ? ? ? | 47 ++++++++++++++++++-
?4 files changed, 82 insertions(+), 1 deletion(-)
?create mode 100755 apps/TvSettings/Settings/res/layout/PwdDialog.xml

diff --git a/apps/TvSettings/Settings/res/layout/PwdDialog.xml b/apps/TvSettings/Settings/res/layout/PwdDialog.xml
new file mode 100755
index 00000000..cb3f29ce
--- /dev/null
+++ b/apps/TvSettings/Settings/res/layout/PwdDialog.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ ? ? 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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ ? ?android:id="@+id/pwdDialog"
+ ? ?android:layout_width="match_parent"
+ ? ?android:layout_height="match_parent" >
+
+ ? ?<EditText
+ ? ? ? ?android:id="@+id/pwd_edit"
+ ? ? ? ?android:layout_width="wrap_content"
+?? ??? ?android:layout_height="wrap_content"
+?? ??? ?android:layout_marginStart="21dp"
+ ? ? ? ?android:layout_marginEnd="24dp"
+ ? ? ? ?android:layout_marginTop="20dp"
+ ? ? ? ?android:minHeight="48dp"
+ ? ? ? ?android:inputType="textPassword"
+ ? ? ? ?android:singleLine="true" />
+
+</RelativeLayout>
diff --git a/apps/TvSettings/Settings/res/values/strings_hi.xml b/apps/TvSettings/Settings/res/values/strings_hi.xml
index 85300c57..72edee52 100755
--- a/apps/TvSettings/Settings/res/values/strings_hi.xml
+++ b/apps/TvSettings/Settings/res/values/strings_hi.xml
@@ -443,5 +443,8 @@
? ? ?<string name="device_rotation_90">90</string>
? ? ?<string name="device_rotation_180">180</string>
? ? ?<string name="device_rotation_270">270</string>
+?? ?
+?? ?<string name="dialog_pwd_tips">\u0020\u0020\u0020\u0020 Please Input Your Password !</string>
+?? ?<string name="pwd_error">Password Error!</string>
?
?</resources>
diff --git a/apps/TvSettings/Settings/src/com/android/tv/settings/MainFragment.java b/apps/TvSettings/Settings/src/com/android/tv/settings/MainFragment.java
index b2a4e67d..2db920cd 100755
--- a/apps/TvSettings/Settings/src/com/android/tv/settings/MainFragment.java
+++ b/apps/TvSettings/Settings/src/com/android/tv/settings/MainFragment.java
@@ -240,6 +240,7 @@ public class MainFragment extends PreferenceControllerFragment implements
? ? ? ? ? ? ? ? ?accountsPref.setVisible(false);
? ? ? ? ? ? ?}
? ? ? ? ?}
+ ? ? ? ? ? ?findPreference(KEY_APPLICATIONS).setVisible(false);
? ? ? ? ? ? ?Preference accessoryPreference = findPreference(KEY_ACCESSORIES);
? ? ? ? ? ? ?if (accessoryPreference != null) {
? ? ? ? ? ? ? ? ?accessoryPreference.setVisible(false);
diff --git a/apps/TvSettings/Settings/src/com/android/tv/settings/device/storage/ResetActivity.java b/apps/TvSettings/Settings/src/com/android/tv/settings/device/storage/ResetActivity.java
index d989b082..15f883f2 100644
--- a/apps/TvSettings/Settings/src/com/android/tv/settings/device/storage/ResetActivity.java
+++ b/apps/TvSettings/Settings/src/com/android/tv/settings/device/storage/ResetActivity.java
@@ -19,6 +19,15 @@ package com.android.tv.settings.device.storage;
?import android.annotation.Nullable;
?import android.app.Activity;
?import android.app.ActivityManager;
+import android.app.AlertDialog;
+import android.view.View;
+import android.widget.Toast;
+import android.widget.EditText;
+import android.view.LayoutInflater;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.DialogInterface.OnClickListener;
+import android.content.DialogInterface.OnKeyListener;
?import android.content.Intent;
?import android.os.Bundle;
?import android.support.annotation.NonNull;
@@ -34,6 +43,7 @@ import java.util.List;
?public class ResetActivity extends Activity {
?
? ? ?private static final String TAG = "ResetActivity";
+ ? ?private static final String PWSSORD = "88888888";
?
? ? ?/**
? ? ? * Support for shutdown-after-reset. If our launch intent has a true value for
@@ -47,7 +57,42 @@ public class ResetActivity extends Activity {
? ? ?protected void onCreate(@Nullable Bundle savedInstanceState) {
? ? ? ? ?super.onCreate(savedInstanceState);
? ? ? ? ?if (savedInstanceState == null) {
- ? ? ? ? ? ?GuidedStepFragment.addAsRoot(this, ResetFragment.newInstance(), android.R.id.content);
+ ? ? ? ?AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ ? ? ? ?//builder.setMessage(R.string.dialog_summary_virtual_screen);
+ ? ? ? ?//builder.setMessage("setMessage");
+ ? ? ? ?builder.setTitle(R.string.dialog_pwd_tips);
+?? ??? ?View view = LayoutInflater.from(this).inflate(R.layout.PwdDialog, null);
+?? ??? ?builder.setView(view);
+?? ??? ?final EditText password = (EditText)view.findViewById(R.id.pwd_edit);
+
+ ? ? ? ?builder.setPositiveButton(R.string.sure, new OnClickListener() {
+ ? ? ? ? ? ?public void onClick(DialogInterface dialog, int which) {
+?? ??? ??? ??? ??? ?String passwd = password.getText().toString().trim();
+?? ??? ??? ??? ??? ?if(PWSSORD.equals(passwd)) {
+?? ??? ??? ??? ??? ??? ?GuidedStepFragment.addAsRoot(ResetActivity.this, ResetFragment.newInstance(), android.R.id.content);
+?? ??? ??? ??? ??? ?} else {
+?? ??? ??? ??? ??? ??? ?Toast.makeText(ResetActivity.this, getString(R.string.pwd_error), Toast.LENGTH_SHORT).show();
+?? ??? ??? ??? ??? ??? ?ResetActivity.this.finish();
+?? ??? ??? ??? ??? ?}
+ ? ? ? ? ? ?}
+ ? ? ? ?});
+ ? ? ? ?builder.setNegativeButton(R.string.cancel, null);
+?? ?/*?? ?builder.setOnDismissListener(
+ ? ? ? ? ? ? ? ? ? ? ? ?new DialogInterface.OnDismissListener() {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ?@Override
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ?public void onDismiss(DialogInterface dialog) {
+?? ??? ??? ??? ??? ??? ??? ??? ?ResetActivity.this.finish();
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
+ ? ? ? ? ? ? ? ? ? ? ? ?});
+ ? ? */ ? ? ? ? ?
+ ? ? ? ?AlertDialog alertDialog = builder.create();
+ ? ? ? ?alertDialog.show();
+
+ ? ? ? ?//alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).requestFocus();
+ ? ? ? ?password.requestFocus();
+ ??
+?? ??? ??? ?
+?? ??? ??? ?
? ? ? ? ?}
? ? ?}
?
--?diff --git a/apps/PackageInstaller/src/com/android/packageinstaller/InstallStaging.java b/apps/PackageInstaller/src/com/android/packageinstaller/InstallStaging.java
index f543971a..83eb7ba3 100644
--- a/apps/PackageInstaller/src/com/android/packageinstaller/InstallStaging.java
+++ b/apps/PackageInstaller/src/com/android/packageinstaller/InstallStaging.java
@@ -56,6 +56,14 @@ public class InstallStaging extends Activity {
? ? ? ? ?super.onCreate(savedInstanceState);
?
? ? ? ? ?setContentView(R.layout.install_staging);
+?? ??? ?String uriPath = getIntent().getData().toString();
+?? ??? ?if(uriPath != null) {
+?? ??? ??? ?Log.w(LOG_TAG, "aaaaa apk path from "+uriPath);
+?? ??? ??? ?if(uriPath.contains("/storage/sd")) {
+?? ??? ??? ??? ?setResult(RESULT_CANCELED);
+?? ??? ??? ??? ?finish();
+?? ??? ??? ?}
+?? ??? ?}
?
? ? ? ? ?if (savedInstanceState != null) {
? ? ? ? ? ? ?mStagedFile = new File(savedInstanceState.getString(STAGED_FILE));
?

  移动开发 最新文章
Vue3装载axios和element-ui
android adb cmd
【xcode】Xcode常用快捷键与技巧
Android开发中的线程池使用
Java 和 Android 的 Base64
Android 测试文字编码格式
微信小程序支付
安卓权限记录
知乎之自动养号
【Android Jetpack】DataStore
上一篇文章      下一篇文章      查看所有文章
加:2021-07-14 23:07:06  更:2021-07-14 23:07:35 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/2 2:17:20-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码