Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2eb12a47 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 01e4cfc4: Some ActivityThread/ActivityManager cleanup.

Merge commit '01e4cfc4' into gingerbread-plus-aosp

* commit '01e4cfc4':
  Some ActivityThread/ActivityManager cleanup.
parents 95d26de9 01e4cfc4
Loading
Loading
Loading
Loading
+264 −1317

File changed.

Preview size limit exceeded, changes collapsed.

+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 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 android.app;

import android.content.pm.IPackageManager;

/**
 * Special private access for certain globals related to a process.
 * @hide
 */
public class AppGlobals {
    /**
     * Return the first Application object made in the process.
     * NOTE: Only works on the main thread.
     */
    public static Application getInitialApplication() {
        return ActivityThread.currentApplication();
    }
    
    /**
     * Return the package name of the first .apk loaded into the process.
     * NOTE: Only works on the main thread.
     */
    public static String getInitialPackage() {
        return ActivityThread.currentPackageName();
    }
    
    /**
     * Return the raw interface to the package manager.
     * @return
     */
    public static IPackageManager getPackageManager() {
        return ActivityThread.getPackageManager();
    }
}
+7 −7
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class ContextImpl extends Context {
            new HashMap<File, SharedPreferencesImpl>();

    private AudioManager mAudioManager;
    /*package*/ ActivityThread.PackageInfo mPackageInfo;
    /*package*/ LoadedApk mPackageInfo;
    private Resources mResources;
    /*package*/ ActivityThread mMainThread;
    private Context mOuterContext;
@@ -696,7 +696,7 @@ class ContextImpl extends Context {
                if (scheduler == null) {
                    scheduler = mMainThread.getHandler();
                }
                rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
                rd = new LoadedApk.ReceiverDispatcher(
                        resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver();
            }
        }
@@ -739,7 +739,7 @@ class ContextImpl extends Context {
                if (scheduler == null) {
                    scheduler = mMainThread.getHandler();
                }
                rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
                rd = new LoadedApk.ReceiverDispatcher(
                        resultReceiver, getOuterContext(), scheduler, null, false).getIIntentReceiver();
            }
        }
@@ -795,7 +795,7 @@ class ContextImpl extends Context {
                if (scheduler == null) {
                    scheduler = mMainThread.getHandler();
                }
                rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
                rd = new LoadedApk.ReceiverDispatcher(
                        receiver, context, scheduler, null, true).getIIntentReceiver();
            }
        }
@@ -1425,7 +1425,7 @@ class ContextImpl extends Context {
            return new ContextImpl(mMainThread.getSystemContext());
        }

        ActivityThread.PackageInfo pi =
        LoadedApk pi =
            mMainThread.getPackageInfo(packageName, flags);
        if (pi != null) {
            ContextImpl c = new ContextImpl();
@@ -1492,12 +1492,12 @@ class ContextImpl extends Context {
        mOuterContext = this;
    }

    final void init(ActivityThread.PackageInfo packageInfo,
    final void init(LoadedApk packageInfo,
            IBinder activityToken, ActivityThread mainThread) {
        init(packageInfo, activityToken, mainThread, null);
    }

    final void init(ActivityThread.PackageInfo packageInfo,
    final void init(LoadedApk packageInfo,
                IBinder activityToken, ActivityThread mainThread,
                Resources container) {
        mPackageInfo = packageInfo;
+1103 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.content;

import android.accounts.Account;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
@@ -1306,7 +1307,7 @@ public abstract class ContentResolver {
        // ActivityThread.currentPackageName() only returns non-null if the
        // current thread is an application main thread.  This parameter tells
        // us whether an event loop is blocked, and if so, which app it is.
        String blockingPackage = ActivityThread.currentPackageName();
        String blockingPackage = AppGlobals.getInitialPackage();

        EventLog.writeEvent(
            EventLogTags.CONTENT_QUERY_SAMPLE,
@@ -1329,7 +1330,7 @@ public abstract class ContentResolver {
                }
            }
        }
        String blockingPackage = ActivityThread.currentPackageName();
        String blockingPackage = AppGlobals.getInitialPackage();
        EventLog.writeEvent(
            EventLogTags.CONTENT_UPDATE_SAMPLE,
            uri.toString(),
Loading