am cab997b2
: Merge "Fix 6667238: allow market apps to support ACTION_ASSIST" into jb-dev
* commit 'cab997b2020ddb67158397dccadd28d91a7710d0': Fix 6667238: allow market apps to support ACTION_ASSIST
This commit is contained in:
@ -840,29 +840,17 @@ public class SearchManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the global assist activity is available.
|
* Gets an intent for launching installed assistant activity, or null if not available.
|
||||||
* @return True if the assistant is available.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public final boolean isAssistantAvailable() {
|
|
||||||
Intent intent = getAssistIntent();
|
|
||||||
return intent != null
|
|
||||||
&& mContext.getPackageManager().queryIntentActivities(intent,
|
|
||||||
PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an intent to launch the global assist activity, or null if not available.
|
|
||||||
* @return The assist intent.
|
* @return The assist intent.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final Intent getAssistIntent() {
|
public static final Intent getAssistIntent(Context context) {
|
||||||
ComponentName globalSearchActivity = getGlobalSearchActivity();
|
PackageManager pm = context.getPackageManager();
|
||||||
if (globalSearchActivity != null) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_ASSIST);
|
Intent intent = new Intent(Intent.ACTION_ASSIST);
|
||||||
intent.setPackage(globalSearchActivity.getPackageName());
|
ComponentName component = intent.resolveActivity(pm);
|
||||||
|
if (component != null) {
|
||||||
|
intent.setComponent(component);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -29,7 +29,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.RectF;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
@ -1209,6 +1208,8 @@ public class GlowPadView extends View {
|
|||||||
int existingResId) {
|
int existingResId) {
|
||||||
if (existingResId == 0) return false;
|
if (existingResId == 0) return false;
|
||||||
|
|
||||||
|
boolean replaced = false;
|
||||||
|
if (component != null) {
|
||||||
try {
|
try {
|
||||||
PackageManager packageManager = mContext.getPackageManager();
|
PackageManager packageManager = mContext.getPackageManager();
|
||||||
// Look for the search icon specified in the activity meta-data
|
// Look for the search icon specified in the activity meta-data
|
||||||
@ -1218,7 +1219,7 @@ public class GlowPadView extends View {
|
|||||||
int iconResId = metaData.getInt(name);
|
int iconResId = metaData.getInt(name);
|
||||||
if (iconResId != 0) {
|
if (iconResId != 0) {
|
||||||
Resources res = packageManager.getResourcesForActivity(component);
|
Resources res = packageManager.getResourcesForActivity(component);
|
||||||
return replaceTargetDrawables(res, existingResId, iconResId);
|
replaced = replaceTargetDrawables(res, existingResId, iconResId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
@ -1228,6 +1229,11 @@ public class GlowPadView extends View {
|
|||||||
Log.w(TAG, "Failed to swap drawable from "
|
Log.w(TAG, "Failed to swap drawable from "
|
||||||
+ component.flattenToShortString(), nfe);
|
+ component.flattenToShortString(), nfe);
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
if (!replaced) {
|
||||||
|
// Restore the original drawable
|
||||||
|
replaceTargetDrawables(mContext.getResources(), existingResId, existingResId);
|
||||||
|
}
|
||||||
|
return replaced;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ public class SearchPanelView extends FrameLayout implements
|
|||||||
private static final String ASSIST_ICON_METADATA_NAME =
|
private static final String ASSIST_ICON_METADATA_NAME =
|
||||||
"com.android.systemui.action_assist_icon";
|
"com.android.systemui.action_assist_icon";
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final SearchManager mSearchManager;
|
|
||||||
private BaseStatusBar mBar;
|
private BaseStatusBar mBar;
|
||||||
private StatusBarTouchProxy mStatusBarTouchProxy;
|
private StatusBarTouchProxy mStatusBarTouchProxy;
|
||||||
|
|
||||||
@ -68,25 +67,13 @@ public class SearchPanelView extends FrameLayout implements
|
|||||||
public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
|
public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
|
||||||
if (mSearchManager == null) {
|
|
||||||
Slog.w(TAG, "Search manager not available");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAssistantAvailable() {
|
|
||||||
return mSearchManager != null && mSearchManager.isAssistantAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Intent getAssistIntent() {
|
|
||||||
return mSearchManager != null ? mSearchManager.getAssistIntent() : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startAssistActivity() {
|
private void startAssistActivity() {
|
||||||
// Close Recent Apps if needed
|
// Close Recent Apps if needed
|
||||||
mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
|
mBar.animateCollapse(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
|
||||||
// Launch Assist
|
// Launch Assist
|
||||||
Intent intent = getAssistIntent();
|
Intent intent = SearchManager.getAssistIntent(mContext);
|
||||||
if (intent == null) return;
|
if (intent == null) return;
|
||||||
try {
|
try {
|
||||||
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
|
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
|
||||||
@ -150,19 +137,17 @@ public class SearchPanelView extends FrameLayout implements
|
|||||||
// TODO: fetch views
|
// TODO: fetch views
|
||||||
mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
|
mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
|
||||||
mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
|
mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
|
||||||
if (mSearchManager != null) {
|
}
|
||||||
ComponentName component = mSearchManager.getGlobalSearchActivity();
|
|
||||||
if (component != null) {
|
private void maybeSwapSearchIcon() {
|
||||||
if (!mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
Intent intent = SearchManager.getAssistIntent(mContext);
|
||||||
|
if (intent != null) {
|
||||||
|
ComponentName component = intent.getComponent();
|
||||||
|
if (component == null || !mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
||||||
ASSIST_ICON_METADATA_NAME,
|
ASSIST_ICON_METADATA_NAME,
|
||||||
com.android.internal.R.drawable.ic_action_assist_generic)) {
|
com.android.internal.R.drawable.ic_action_assist_generic)) {
|
||||||
Slog.w(TAG, "Couldn't grab icon from component " + component);
|
if (DEBUG) Slog.v(TAG, "Couldn't grab icon for component " + component);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Slog.w(TAG, "No search icon specified in component " + component);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Slog.w(TAG, "No SearchManager");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +195,7 @@ public class SearchPanelView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
mShowing = show;
|
mShowing = show;
|
||||||
if (show) {
|
if (show) {
|
||||||
|
maybeSwapSearchIcon();
|
||||||
if (getVisibility() != View.VISIBLE) {
|
if (getVisibility() != View.VISIBLE) {
|
||||||
setVisibility(View.VISIBLE);
|
setVisibility(View.VISIBLE);
|
||||||
// Don't start the animation until we've created the layer, which is done
|
// Don't start the animation until we've created the layer, which is done
|
||||||
@ -289,4 +275,8 @@ public class SearchPanelView extends FrameLayout implements
|
|||||||
transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
|
transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
|
||||||
return transitioner;
|
return transitioner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAssistantAvailable() {
|
||||||
|
return SearchManager.getAssistIntent(mContext) != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
private View mUnlockWidget;
|
private View mUnlockWidget;
|
||||||
private boolean mCameraDisabled;
|
private boolean mCameraDisabled;
|
||||||
private boolean mSearchDisabled;
|
private boolean mSearchDisabled;
|
||||||
private SearchManager mSearchManager;
|
|
||||||
// Is there a vibrator
|
// Is there a vibrator
|
||||||
private final boolean mHasVibrator;
|
private final boolean mHasVibrator;
|
||||||
|
|
||||||
@ -253,23 +252,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAssistantAvailable() {
|
|
||||||
SearchManager searchManager = getSearchManager();
|
|
||||||
return searchManager != null && searchManager.isAssistantAvailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Intent getAssistIntent() {
|
|
||||||
SearchManager searchManager = getSearchManager();
|
|
||||||
return searchManager != null ? searchManager.getAssistIntent() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SearchManager getSearchManager() {
|
|
||||||
if (mSearchManager == null) {
|
|
||||||
mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
|
||||||
}
|
|
||||||
return mSearchManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
class GlowPadViewMethods implements GlowPadView.OnTriggerListener,
|
class GlowPadViewMethods implements GlowPadView.OnTriggerListener,
|
||||||
UnlockWidgetCommonMethods {
|
UnlockWidgetCommonMethods {
|
||||||
private final GlowPadView mGlowPadView;
|
private final GlowPadView mGlowPadView;
|
||||||
@ -297,13 +279,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
|
|
||||||
// Update the search icon with drawable from the search .apk
|
// Update the search icon with drawable from the search .apk
|
||||||
if (!mSearchDisabled) {
|
if (!mSearchDisabled) {
|
||||||
SearchManager searchManager = getSearchManager();
|
Intent intent = SearchManager.getAssistIntent(mContext);
|
||||||
if (searchManager != null) {
|
if (intent != null) {
|
||||||
ComponentName component = searchManager.getGlobalSearchActivity();
|
|
||||||
if (component != null) {
|
|
||||||
// XXX Hack. We need to substitute the icon here but haven't formalized
|
// XXX Hack. We need to substitute the icon here but haven't formalized
|
||||||
// the public API. The "_google" metadata will be going away, so
|
// the public API. The "_google" metadata will be going away, so
|
||||||
// DON'T USE IT!
|
// DON'T USE IT!
|
||||||
|
ComponentName component = intent.getComponent();
|
||||||
boolean replaced = mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
boolean replaced = mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
||||||
ASSIST_ICON_METADATA_NAME + "_google",
|
ASSIST_ICON_METADATA_NAME + "_google",
|
||||||
com.android.internal.R.drawable.ic_action_assist_generic);
|
com.android.internal.R.drawable.ic_action_assist_generic);
|
||||||
@ -313,11 +294,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
com.android.internal.R.drawable.ic_action_assist_generic)) {
|
com.android.internal.R.drawable.ic_action_assist_generic)) {
|
||||||
Slog.w(TAG, "Couldn't grab icon from package " + component);
|
Slog.w(TAG, "Couldn't grab icon from package " + component);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Slog.w(TAG, "No search icon specified in package " + component);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Slog.w(TAG, "No SearchManager");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +313,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
final int resId = mGlowPadView.getResourceIdForTarget(target);
|
final int resId = mGlowPadView.getResourceIdForTarget(target);
|
||||||
switch (resId) {
|
switch (resId) {
|
||||||
case com.android.internal.R.drawable.ic_action_assist_generic:
|
case com.android.internal.R.drawable.ic_action_assist_generic:
|
||||||
Intent assistIntent = getAssistIntent();
|
Intent assistIntent = SearchManager.getAssistIntent(mContext);
|
||||||
if (assistIntent != null) {
|
if (assistIntent != null) {
|
||||||
launchActivity(assistIntent);
|
launchActivity(assistIntent);
|
||||||
} else {
|
} else {
|
||||||
@ -550,7 +526,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
|||||||
} else if (disabledBySimState) {
|
} else if (disabledBySimState) {
|
||||||
Log.v(TAG, "Camera disabled by Sim State");
|
Log.v(TAG, "Camera disabled by Sim State");
|
||||||
}
|
}
|
||||||
boolean searchActionAvailable = isAssistantAvailable();
|
boolean searchActionAvailable = SearchManager.getAssistIntent(mContext) != null;
|
||||||
mCameraDisabled = disabledByAdmin || disabledBySimState || !cameraTargetPresent;
|
mCameraDisabled = disabledByAdmin || disabledBySimState || !cameraTargetPresent;
|
||||||
mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent;
|
mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent;
|
||||||
mUnlockWidgetMethods.updateResources();
|
mUnlockWidgetMethods.updateResources();
|
||||||
|
@ -2081,6 +2081,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
Intent intent = new Intent(Intent.ACTION_SEARCH_LONG_PRESS);
|
Intent intent = new Intent(Intent.ACTION_SEARCH_LONG_PRESS);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
try {
|
try {
|
||||||
|
// TODO: This only stops the factory-installed search manager.
|
||||||
|
// Need to formalize an API to handle others
|
||||||
SearchManager searchManager = getSearchManager();
|
SearchManager searchManager = getSearchManager();
|
||||||
if (searchManager != null) {
|
if (searchManager != null) {
|
||||||
searchManager.stopSearch();
|
searchManager.stopSearch();
|
||||||
@ -2093,10 +2095,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
|
|
||||||
private void launchAssistAction() {
|
private void launchAssistAction() {
|
||||||
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
|
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_ASSIST);
|
||||||
|
Intent intent = SearchManager.getAssistIntent(mContext);
|
||||||
SearchManager searchManager = getSearchManager();
|
|
||||||
if (searchManager != null) {
|
|
||||||
Intent intent = searchManager.getAssistIntent();
|
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP
|
| Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||||
@ -2108,7 +2107,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private SearchManager getSearchManager() {
|
private SearchManager getSearchManager() {
|
||||||
if (mSearchManager == null) {
|
if (mSearchManager == null) {
|
||||||
|
11
tests/Assistant/Android.mk
Normal file
11
tests/Assistant/Android.mk
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||||
|
|
||||||
|
LOCAL_PACKAGE_NAME := Assistant
|
||||||
|
|
||||||
|
LOCAL_MODULE_TAGS := tests
|
||||||
|
LOCAL_CERTIFICATE := platform
|
||||||
|
|
||||||
|
include $(BUILD_PACKAGE)
|
39
tests/Assistant/AndroidManifest.xml
Normal file
39
tests/Assistant/AndroidManifest.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2008 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.google.android.test.assistant">
|
||||||
|
|
||||||
|
<application android:label="@string/activity_title">
|
||||||
|
|
||||||
|
<activity android:name=".AssistActivity"
|
||||||
|
android:theme="@android:style/Theme.NoTitleBar">
|
||||||
|
|
||||||
|
<!-- Handle assist intent -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.ASSIST" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<!-- Provide icon for search -->
|
||||||
|
<meta-data android:name="com.android.systemui.action_assist_icon"
|
||||||
|
android:resource="@drawable/ic_action_assist" />
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
BIN
tests/Assistant/res/drawable-hdpi/ic_action_assist_activated.png
Normal file
BIN
tests/Assistant/res/drawable-hdpi/ic_action_assist_activated.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
tests/Assistant/res/drawable-hdpi/ic_action_assist_normal.png
Normal file
BIN
tests/Assistant/res/drawable-hdpi/ic_action_assist_normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
tests/Assistant/res/drawable-mdpi/ic_action_assist_activated.png
Normal file
BIN
tests/Assistant/res/drawable-mdpi/ic_action_assist_activated.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
tests/Assistant/res/drawable-mdpi/ic_action_assist_normal.png
Normal file
BIN
tests/Assistant/res/drawable-mdpi/ic_action_assist_normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
tests/Assistant/res/drawable-xhdpi/ic_action_assist_normal.png
Normal file
BIN
tests/Assistant/res/drawable-xhdpi/ic_action_assist_normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
36
tests/Assistant/res/drawable/ic_action_assist.xml
Normal file
36
tests/Assistant/res/drawable/ic_action_assist.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2012 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.
|
||||||
|
-->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_active="false"
|
||||||
|
android:state_focused="false"
|
||||||
|
android:drawable="@drawable/ic_action_assist_normal" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_active="true"
|
||||||
|
android:state_focused="false"
|
||||||
|
android:drawable="@drawable/ic_action_assist_activated" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_active="false"
|
||||||
|
android:state_focused="true"
|
||||||
|
android:drawable="@drawable/ic_action_assist_activated" />
|
||||||
|
|
||||||
|
</selector>
|
43
tests/Assistant/res/layout/assist_intent_activity.xml
Normal file
43
tests/Assistant/res/layout/assist_intent_activity.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
**
|
||||||
|
** Copyright 2009, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- This is the general lock screen which shows information about the
|
||||||
|
state of the device, as well as instructions on how to get past it
|
||||||
|
depending on the state of the device. It is the same for landscape
|
||||||
|
and portrait.-->
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/search_label"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EditText android:id="@+id/search_input"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
20
tests/Assistant/res/values/strings.xml
Normal file
20
tests/Assistant/res/values/strings.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<string name="activity_title">Assistant</string>
|
||||||
|
<string name="search_label">Orilla Search Engine</string>
|
||||||
|
</resources>
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 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.google.android.test.assistant;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import com.google.android.test.assistant.R;
|
||||||
|
|
||||||
|
public class AssistActivity extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.assist_intent_activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user