am 3b9a3cc0
: Update GlobalActions for watches.
* commit '3b9a3cc02ecb025f8b1f322015c7d1fb46222f9e': Update GlobalActions for watches.
This commit is contained in:
BIN
core/res/res/drawable-hdpi/ic_settings.png
Normal file
BIN
core/res/res/drawable-hdpi/ic_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
core/res/res/drawable-mdpi/ic_settings.png
Normal file
BIN
core/res/res/drawable-mdpi/ic_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
core/res/res/drawable-xhdpi/ic_settings.png
Normal file
BIN
core/res/res/drawable-xhdpi/ic_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
core/res/res/drawable-xxhdpi/ic_settings.png
Normal file
BIN
core/res/res/drawable-xxhdpi/ic_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
30
core/res/res/values-watch/config.xml
Normal file
30
core/res/res/values-watch/config.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
** Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- These resources are around just to allow their values to be customized
|
||||||
|
for watch products. Do not translate. -->
|
||||||
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
|
||||||
|
<!-- Only show power and settings items due to smaller real estate. -->
|
||||||
|
<string-array translatable="false" name="config_globalActionsList">
|
||||||
|
<item>power</item>
|
||||||
|
<item>settings</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
</resources>
|
@ -1420,4 +1420,22 @@
|
|||||||
<!-- default window inset isRound property -->
|
<!-- default window inset isRound property -->
|
||||||
<bool name="config_windowIsRound">false</bool>
|
<bool name="config_windowIsRound">false</bool>
|
||||||
|
|
||||||
|
<!-- Defines the default set of global actions. Actions may still be disabled or hidden based
|
||||||
|
on the current state of the device.
|
||||||
|
Each item must be one of the following strings:
|
||||||
|
"power" = Power off
|
||||||
|
"settings" = An action to launch settings
|
||||||
|
"airplane" = Airplane mode toggle
|
||||||
|
"bugreport" = Take bug report, if available
|
||||||
|
"silent" = silent mode
|
||||||
|
"users" = list of users
|
||||||
|
-->
|
||||||
|
<string-array translatable="false" name="config_globalActionsList">
|
||||||
|
<item>power</item>
|
||||||
|
<item>airplane</item>
|
||||||
|
<item>bugreport</item>
|
||||||
|
<item>silent</item>
|
||||||
|
<item>users</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -399,6 +399,9 @@
|
|||||||
<!-- status message in phone options dialog for when airplane mode is off -->
|
<!-- status message in phone options dialog for when airplane mode is off -->
|
||||||
<string name="global_actions_airplane_mode_off_status">Airplane mode is OFF</string>
|
<string name="global_actions_airplane_mode_off_status">Airplane mode is OFF</string>
|
||||||
|
|
||||||
|
<!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]-->
|
||||||
|
<string name="global_action_settings">Settings</string>
|
||||||
|
|
||||||
<!-- Text to use when the number in a notification info is too large
|
<!-- Text to use when the number in a notification info is too large
|
||||||
(greater than status_bar_notification_info_maxnum, defined in
|
(greater than status_bar_notification_info_maxnum, defined in
|
||||||
values/config.xml) and must be truncated. May need to be localized
|
values/config.xml) and must be truncated. May need to be localized
|
||||||
|
@ -988,6 +988,7 @@
|
|||||||
<java-symbol type="array" name="config_operatorConsideredNonRoaming" />
|
<java-symbol type="array" name="config_operatorConsideredNonRoaming" />
|
||||||
<java-symbol type="array" name="config_sameNamedOperatorConsideredRoaming" />
|
<java-symbol type="array" name="config_sameNamedOperatorConsideredRoaming" />
|
||||||
<java-symbol type="array" name="config_callBarringMMI" />
|
<java-symbol type="array" name="config_callBarringMMI" />
|
||||||
|
<java-symbol type="array" name="config_globalActionsList" />
|
||||||
|
|
||||||
<java-symbol type="drawable" name="default_wallpaper" />
|
<java-symbol type="drawable" name="default_wallpaper" />
|
||||||
<java-symbol type="drawable" name="indicator_input_error" />
|
<java-symbol type="drawable" name="indicator_input_error" />
|
||||||
@ -1389,6 +1390,7 @@
|
|||||||
<java-symbol type="string" name="global_actions_airplane_mode_on_status" />
|
<java-symbol type="string" name="global_actions_airplane_mode_on_status" />
|
||||||
<java-symbol type="string" name="global_actions_toggle_airplane_mode" />
|
<java-symbol type="string" name="global_actions_toggle_airplane_mode" />
|
||||||
<java-symbol type="string" name="global_action_bug_report" />
|
<java-symbol type="string" name="global_action_bug_report" />
|
||||||
|
<java-symbol type="string" name="global_action_settings" />
|
||||||
<java-symbol type="string" name="global_action_silent_mode_off_status" />
|
<java-symbol type="string" name="global_action_silent_mode_off_status" />
|
||||||
<java-symbol type="string" name="global_action_silent_mode_on_status" />
|
<java-symbol type="string" name="global_action_silent_mode_on_status" />
|
||||||
<java-symbol type="string" name="global_action_toggle_silent_mode" />
|
<java-symbol type="string" name="global_action_toggle_silent_mode" />
|
||||||
@ -1461,6 +1463,7 @@
|
|||||||
<java-symbol type="color" name="input_method_navigation_guard" />
|
<java-symbol type="color" name="input_method_navigation_guard" />
|
||||||
<java-symbol type="drawable" name="ic_notification_ime_default" />
|
<java-symbol type="drawable" name="ic_notification_ime_default" />
|
||||||
<java-symbol type="drawable" name="ic_menu_refresh" />
|
<java-symbol type="drawable" name="ic_menu_refresh" />
|
||||||
|
<java-symbol type="drawable" name="ic_settings" />
|
||||||
<java-symbol type="drawable" name="stat_notify_car_mode" />
|
<java-symbol type="drawable" name="stat_notify_car_mode" />
|
||||||
<java-symbol type="drawable" name="stat_notify_disabled" />
|
<java-symbol type="drawable" name="stat_notify_disabled" />
|
||||||
<java-symbol type="drawable" name="stat_notify_disk_full" />
|
<java-symbol type="drawable" name="stat_notify_disk_full" />
|
||||||
|
@ -51,6 +51,7 @@ import android.service.dreams.IDreamManager;
|
|||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
@ -83,6 +84,15 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
|
|
||||||
private static final boolean SHOW_SILENT_TOGGLE = true;
|
private static final boolean SHOW_SILENT_TOGGLE = true;
|
||||||
|
|
||||||
|
/* Valid settings for global actions keys.
|
||||||
|
* see config.xml config_globalActionList */
|
||||||
|
private static final String GLOBAL_ACTION_KEY_POWER = "power";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_SILENT = "silent";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_USERS = "users";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final WindowManagerFuncs mWindowManagerFuncs;
|
private final WindowManagerFuncs mWindowManagerFuncs;
|
||||||
private final AudioManager mAudioManager;
|
private final AudioManager mAudioManager;
|
||||||
@ -235,10 +245,67 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
onAirplaneModeChanged();
|
onAirplaneModeChanged();
|
||||||
|
|
||||||
mItems = new ArrayList<Action>();
|
mItems = new ArrayList<Action>();
|
||||||
|
String[] defaultActions = mContext.getResources().getStringArray(
|
||||||
|
com.android.internal.R.array.config_globalActionsList);
|
||||||
|
|
||||||
// first: power off
|
ArraySet<String> addedKeys = new ArraySet<String>();
|
||||||
mItems.add(
|
for (int i = 0; i < defaultActions.length; i++) {
|
||||||
new SinglePressAction(
|
String actionKey = defaultActions[i];
|
||||||
|
if (addedKeys.contains(actionKey)) {
|
||||||
|
// If we already have added this, don't add it again.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (GLOBAL_ACTION_KEY_POWER.equals(actionKey)) {
|
||||||
|
mItems.add(getPowerAction());
|
||||||
|
} else if (GLOBAL_ACTION_KEY_AIRPLANE.equals(actionKey)) {
|
||||||
|
mItems.add(mAirplaneModeOn);
|
||||||
|
} else if (GLOBAL_ACTION_KEY_BUGREPORT.equals(actionKey)
|
||||||
|
&& (Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0 && isCurrentUserOwner())) {
|
||||||
|
mItems.add(getBugReportAction());
|
||||||
|
} else if (GLOBAL_ACTION_KEY_SILENT.equals(actionKey) && mShowSilentToggle) {
|
||||||
|
mItems.add(mSilentModeAction);
|
||||||
|
} else if (GLOBAL_ACTION_KEY_USERS.equals(actionKey)
|
||||||
|
&& SystemProperties.getBoolean("fw.power_user_switcher", false)) {
|
||||||
|
addUsersToMenu(mItems);
|
||||||
|
} else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) {
|
||||||
|
mItems.add(getSettingsAction());
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Invalid global action key " + actionKey);
|
||||||
|
}
|
||||||
|
// Add here so we don't add more than one.
|
||||||
|
addedKeys.add(actionKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAdapter = new MyAdapter();
|
||||||
|
|
||||||
|
AlertParams params = new AlertParams(mContext);
|
||||||
|
params.mAdapter = mAdapter;
|
||||||
|
params.mOnClickListener = this;
|
||||||
|
params.mForceInverseBackground = true;
|
||||||
|
|
||||||
|
GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params);
|
||||||
|
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
||||||
|
|
||||||
|
dialog.getListView().setItemsCanFocus(true);
|
||||||
|
dialog.getListView().setLongClickable(true);
|
||||||
|
dialog.getListView().setOnItemLongClickListener(
|
||||||
|
new AdapterView.OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position,
|
||||||
|
long id) {
|
||||||
|
return mAdapter.getItem(position).onLongPress();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
|
||||||
|
|
||||||
|
dialog.setOnDismissListener(this);
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Action getPowerAction() {
|
||||||
|
return new SinglePressAction(
|
||||||
com.android.internal.R.drawable.ic_lock_power_off,
|
com.android.internal.R.drawable.ic_lock_power_off,
|
||||||
R.string.global_action_power_off) {
|
R.string.global_action_power_off) {
|
||||||
|
|
||||||
@ -259,16 +326,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
public boolean showBeforeProvisioning() {
|
public boolean showBeforeProvisioning() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// next: airplane mode
|
private Action getBugReportAction() {
|
||||||
mItems.add(mAirplaneModeOn);
|
return new SinglePressAction(com.android.internal.R.drawable.stat_sys_adb,
|
||||||
|
|
||||||
// next: bug report, if enabled
|
|
||||||
if (Settings.Global.getInt(mContext.getContentResolver(),
|
|
||||||
Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0 && isCurrentUserOwner()) {
|
|
||||||
mItems.add(
|
|
||||||
new SinglePressAction(com.android.internal.R.drawable.stat_sys_adb,
|
|
||||||
R.string.global_action_bug_report) {
|
R.string.global_action_bug_report) {
|
||||||
|
|
||||||
public void onPress() {
|
public void onPress() {
|
||||||
@ -310,44 +372,35 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
public boolean showBeforeProvisioning() {
|
public boolean showBeforeProvisioning() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// last: silent mode
|
private Action getSettingsAction() {
|
||||||
if (mShowSilentToggle) {
|
return new SinglePressAction(com.android.internal.R.drawable.ic_settings,
|
||||||
mItems.add(mSilentModeAction);
|
R.string.global_action_settings) {
|
||||||
}
|
|
||||||
|
|
||||||
// one more thing: optionally add a list of users to switch to
|
|
||||||
if (SystemProperties.getBoolean("fw.power_user_switcher", false)) {
|
|
||||||
addUsersToMenu(mItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAdapter = new MyAdapter();
|
|
||||||
|
|
||||||
AlertParams params = new AlertParams(mContext);
|
|
||||||
params.mAdapter = mAdapter;
|
|
||||||
params.mOnClickListener = this;
|
|
||||||
params.mForceInverseBackground = true;
|
|
||||||
|
|
||||||
GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params);
|
|
||||||
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
|
||||||
|
|
||||||
dialog.getListView().setItemsCanFocus(true);
|
|
||||||
dialog.getListView().setLongClickable(true);
|
|
||||||
dialog.getListView().setOnItemLongClickListener(
|
|
||||||
new AdapterView.OnItemLongClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position,
|
public void onPress() {
|
||||||
long id) {
|
Intent intent = new Intent(Settings.ACTION_SETTINGS);
|
||||||
return mAdapter.getItem(position).onLongPress();
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
|
|
||||||
|
|
||||||
dialog.setOnDismissListener(this);
|
@Override
|
||||||
|
public boolean onLongPress() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return dialog;
|
@Override
|
||||||
|
public boolean showDuringKeyguard() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showBeforeProvisioning() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserInfo getCurrentUser() {
|
private UserInfo getCurrentUser() {
|
||||||
|
Reference in New Issue
Block a user