/* * Copyright (C) 2007 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. */ package com.android.internal.policy.impl; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; import android.database.Cursor; import android.os.Handler; import android.provider.Settings; import android.util.Log; import android.util.SparseArray; import android.view.KeyCharacterMap; import java.net.URISyntaxException; /** * Manages quick launch shortcuts by: *
* This will first try an exact match (with modifiers), and then try a * match without modifiers (primary character on a key). * * @param kcm The key character map of the device on which the key was pressed. * @param keyCode The key code. * @param metaState The meta state, omitting any modifiers that were used * to invoke the shortcut. * @return The intent that matches the shortcut, or null if not found. */ public Intent getIntent(KeyCharacterMap kcm, int keyCode, int metaState) { Intent intent = null; // First try the exact keycode (with modifiers). int shortcut = kcm.get(keyCode, metaState); if (shortcut != 0) { intent = mShortcutIntents.get(shortcut); } // Next try the primary character on that key. if (intent == null) { shortcut = Character.toLowerCase(kcm.getDisplayLabel(keyCode)); if (shortcut != 0) { intent = mShortcutIntents.get(shortcut); } } return intent; } }