diff options
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 22 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 15 | ||||
-rw-r--r-- | core/java/android/app/ApplicationContext.java | 15 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 5 | ||||
-rw-r--r-- | core/java/android/app/SearchDialog.java | 36 | ||||
-rw-r--r-- | core/java/android/app/SearchManager.java | 19 |
6 files changed, 88 insertions, 24 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 53e6f34..541f413 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -990,6 +990,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case SHUTDOWN_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + boolean res = shutdown(data.readInt()); + reply.writeNoException(); + reply.writeInt(res ? 1 : 0); + return true; + } + case PEEK_SERVICE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); Intent service = Intent.CREATOR.createFromParcel(data); @@ -2160,5 +2168,19 @@ class ActivityManagerProxy implements IActivityManager return res; } + public boolean shutdown(int timeout) throws RemoteException + { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(timeout); + mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); + reply.readException(); + boolean res = reply.readInt() != 0; + reply.recycle(); + data.recycle(); + return res; + } + private IBinder mRemote; } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 2fc476e..1e15d14 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -191,16 +191,11 @@ public final class ActivityThread { usePreloaded = false; DisplayMetrics newMetrics = new DisplayMetrics(); newMetrics.setTo(metrics); - float invertedScale = 1.0f / applicationScale; - newMetrics.density *= invertedScale; - newMetrics.xdpi *= invertedScale; - newMetrics.ydpi *= invertedScale; - newMetrics.widthPixels *= invertedScale; - newMetrics.heightPixels *= invertedScale; + float newDensity = metrics.density / applicationScale; + newMetrics.updateDensity(newDensity); metrics = newMetrics; } - //Log.i(TAG, "Resource:" + appDir + ", density " + newMetrics.density + ", orig density:" + - // metrics.density); + //Log.i(TAG, "Resource:" + appDir + ", display metrics=" + metrics); r = new Resources(assets, metrics, getConfiguration(), usePreloaded); //Log.i(TAG, "Created app resources " + r + ": " + r.getConfiguration()); // XXX need to remove entries when weak references go away @@ -3502,8 +3497,10 @@ public final class ActivityThread { Resources r = v.get(); if (r != null) { // keep the original density based on application cale. - appDm.density = r.getDisplayMetrics().density; + appDm.updateDensity(r.getDisplayMetrics().density); r.updateConfiguration(config, appDm); + // reset + appDm.setTo(dm); //Log.i(TAG, "Updated app resources " + v.getKey() // + " " + r + ": " + r.getConfiguration()); } else { diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index 72d9e3d..d235832 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -2326,15 +2326,26 @@ class ApplicationContext extends Context { } @Override - public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags) { + public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags, + String installerPackageName) { try { - mPM.installPackage(packageURI, observer, flags); + mPM.installPackage(packageURI, observer, flags, installerPackageName); } catch (RemoteException e) { // Should never happen! } } @Override + public String getInstallerPackageName(String packageName) { + try { + return mPM.getInstallerPackageName(packageName); + } catch (RemoteException e) { + // Should never happen! + } + return null; + } + + @Override public void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) { try { mPM.deletePackage(packageName, observer, flags); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 2ac6160..56b29c1 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -16,7 +16,6 @@ package android.app; -import android.app.ActivityManager.MemoryInfo; import android.content.ComponentName; import android.content.ContentProviderNative; import android.content.IContentProvider; @@ -34,7 +33,6 @@ import android.os.IInterface; import android.os.Parcel; import android.os.Parcelable; import android.os.ParcelFileDescriptor; -import android.text.TextUtils; import android.os.Bundle; import java.util.List; @@ -225,6 +223,8 @@ public interface IActivityManager extends IInterface { public boolean profileControl(String process, boolean start, String path) throws RemoteException; + public boolean shutdown(int timeout) throws RemoteException; + /* * Private non-Binder interfaces */ @@ -370,4 +370,5 @@ public interface IActivityManager extends IInterface { int GET_DEVICE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+83; int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84; int PROFILE_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+85; + int SHUTDOWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+86; } diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 8fc2447..343380c 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -171,7 +171,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // having windows anchored by their parent but not clipped by them. ViewGroup.LayoutParams.FILL_PARENT); WindowManager.LayoutParams lp = theWindow.getAttributes(); - lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE; + lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; theWindow.setAttributes(lp); // get the view elements for local access @@ -309,11 +309,23 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS + appSearchData + ", " + globalSearch + ")"); } + // Try to get the searchable info for the provided component (or for global search, + // if globalSearch == true). mSearchable = SearchManager.getSearchableInfo(componentName, globalSearch); - if (mSearchable == null) { - // unfortunately, we can't log here. it would be logspam every time the user - // clicks the "search" key on a non-search app - return false; + + // If we got back nothing, and it wasn't a request for global search, then try again + // for global search, as we'll try to launch that in lieu of any component-specific search. + if (!globalSearch && mSearchable == null) { + globalSearch = true; + mSearchable = SearchManager.getSearchableInfo(componentName, globalSearch); + + // If we still get back null (i.e., there's not even a searchable info available + // for global search), then really give up. + if (mSearchable == null) { + // Unfortunately, we can't log here. it would be logspam every time the user + // clicks the "search" key on a non-search app. + return false; + } } mLaunchComponent = componentName; @@ -325,6 +337,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // show the dialog. this will call onStart(). if (!isShowing()) { + // First make sure the keyboard is showing (if needed), so that we get the right height + // for the dropdown to respect the IME. + if (getContext().getResources().getConfiguration().hardKeyboardHidden == + Configuration.HARDKEYBOARDHIDDEN_YES) { + InputMethodManager inputManager = (InputMethodManager) + getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + inputManager.showSoftInputUnchecked(0, null); + } show(); } @@ -531,9 +551,13 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS if (mGlobalSearchMode) { mSearchAutoComplete.setDropDownAlwaysVisible(true); // fill space until results come in mSearchAutoComplete.setDropDownDismissedOnCompletion(false); + mSearchAutoComplete.setDropDownBackgroundResource( + com.android.internal.R.drawable.search_dropdown_background); } else { mSearchAutoComplete.setDropDownAlwaysVisible(false); mSearchAutoComplete.setDropDownDismissedOnCompletion(true); + mSearchAutoComplete.setDropDownBackgroundResource( + com.android.internal.R.drawable.search_dropdown_background_apps); } // attach the suggestions adapter, if suggestions are available @@ -1329,7 +1353,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS private SearchDialog mSearchDialog; public SearchAutoComplete(Context context) { - super(null); + super(context); mThreshold = getThreshold(); } diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 90de40d..3bf37c3 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -1184,23 +1184,32 @@ public class SearchManager public final static String SUGGEST_URI_PATH_QUERY = "search_suggest_query"; /** + * MIME type for suggestions data. You'll use this in your suggestions content provider + * in the getType() function. + */ + public final static String SUGGEST_MIME_TYPE = + "vnd.android.cursor.dir/vnd.android.search.suggest"; + + /** * Uri path for shortcut validation. This is the path that the search manager will use when * querying your content provider to refresh a shortcutted suggestion result and to check if it * is still valid. When asked, a source may return an up to date result, or no result. No * result indicates the shortcut refers to a no longer valid sugggestion. * * @see #SUGGEST_COLUMN_SHORTCUT_ID - * @hide + * + * @hide pending API council approval */ public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut"; /** - * MIME type for suggestions data. You'll use this in your suggestions content provider + * MIME type for shortcut validation. You'll use this in your suggestions content provider * in the getType() function. + * + * @hide pending API council approval */ - public final static String SUGGEST_MIME_TYPE = - "vnd.android.cursor.dir/vnd.android.search.suggest"; - + public final static String SHORTCUT_MIME_TYPE = + "vnd.android.cursor.item/vnd.android.search.suggest"; /** * Column name for suggestions cursor. <i>Unused - can be null or column can be omitted.</i> */ |