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

Commit 32133d44 authored by Andy Mast's avatar Andy Mast
Browse files

Remove T-mobile items not used by new theme engine

Change-Id: I1e9c14e63ec25fdff61cfd2b7b8a05b1e488e558
parent 2346ae66
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -221,7 +221,6 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/app/IProcessStats.aidl \
	core/java/com/android/internal/app/IUsageStats.aidl \
	core/java/com/android/internal/app/IMediaContainerService.aidl \
	core/java/com/android/internal/app/IAssetRedirectionManager.aidl \
	core/java/com/android/internal/appwidget/IAppWidgetService.aidl \
	core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \
	core/java/com/android/internal/backup/IBackupTransport.aidl \
+0 −24
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 The Android Open Source Project
 * This code has been modified.  Portions copyright (C) 2010, T-Mobile USA, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -1871,16 +1870,6 @@ public class ActivityManager {
            return null;
        }
    }
    /**
     * @hide
     */
    public Configuration getConfiguration() {
        try {
            return ActivityManagerNative.getDefault().getConfiguration();
        } catch (RemoteException e) {
            return null;
        }
    }

    /**
     * Returns a list of application processes that are running on the device.
@@ -2334,17 +2323,4 @@ public class ActivityManager {
            e.printStackTrace(pw);
        }
    }

    /**
     * @throws SecurityException Throws SecurityException if the caller does
     * not hold the {@link android.Manifest.permission#CHANGE_CONFIGURATION} permission.
     *
     * @hide
     */
    public void updateConfiguration(Configuration values) throws SecurityException {
        try {
            ActivityManagerNative.getDefault().updateConfiguration(values);
        } catch (RemoteException e) {
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.content.res.AssetManager;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.CustomTheme;
import android.content.res.PackageRedirectionMap;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDebug;
+0 −13
Original line number Diff line number Diff line
@@ -449,19 +449,6 @@ final class ApplicationPackageManager extends PackageManager {
        }
    }

    @Override
    public List<PackageInfo> getInstalledThemePackages() {
        // Returns a list of theme APKs.
        ArrayList<PackageInfo> finalList = new ArrayList<PackageInfo>();
        List<PackageInfo> installedPackagesList = getInstalledPackages(0);
        for (PackageInfo pi : installedPackagesList) {
            if (pi != null && pi.isThemeApk) {
                finalList.add(pi);
            }
        }
        return finalList;
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<ApplicationInfo> getInstalledApplications(int flags) {
+3 −106
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package android.app;

import static android.app.ActivityThread.DEBUG_CONFIGURATION;

import com.android.internal.app.IAssetRedirectionManager;

import android.content.pm.ActivityInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
@@ -27,7 +25,6 @@ import android.content.res.AssetManager;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.CustomTheme;
import android.content.res.PackageRedirectionMap;
import android.content.res.Resources;
import android.content.res.ResourcesKey;
import android.hardware.display.DisplayManagerGlobal;
@@ -59,7 +56,6 @@ public class ResourcesManager {
            = new ArrayMap<DisplayAdjustments, DisplayMetrics>();

    CompatibilityInfo mResCompatibilityInfo;
    static IAssetRedirectionManager sAssetRedirectionManager;
    static IPackageManager sPackageManager;

    Configuration mResConfiguration;
@@ -217,7 +213,7 @@ public class ResourcesManager {
                config.customTheme = CustomTheme.getBootTheme();
            }

            if (!TextUtils.isEmpty(config.customTheme.getThemePackageName())) {
            if (config.customTheme != null) {
                attachThemeAssets(assets, config.customTheme);
            }
        }
@@ -294,7 +290,7 @@ public class ResourcesManager {
                    AssetManager am = r.getAssets();
                    if (am.hasThemeSupport()) {
                        detachThemeAssets(am);
                        if (!TextUtils.isEmpty(config.customTheme.getThemePackageName())) {
                        if (config.customTheme != null) {
                            attachThemeAssets(am, config.customTheme);
                        }
                    }
@@ -326,106 +322,7 @@ public class ResourcesManager {
            }
        }

        return changes;
    }

    public static IPackageManager getPackageManager() {
        if (sPackageManager != null) {
            //Slog.v("PackageManager", "returning cur default = " + sPackageManager);
            return sPackageManager;
        }
        IBinder b = ServiceManager.getService("package");
        //Slog.v("PackageManager", "default service binder = " + b);
        sPackageManager = IPackageManager.Stub.asInterface(b);
        //Slog.v("PackageManager", "default service = " + sPackageManager);
        return sPackageManager;
    }

    // NOTE: this method can return null if the SystemServer is still
    // initializing (for example, of another SystemServer component is accessing
    // a resources object)
    public static IAssetRedirectionManager getAssetRedirectionManager() {
        if (sAssetRedirectionManager != null) {
            return sAssetRedirectionManager;
        }
        IBinder b = ServiceManager.getService("assetredirection");
        sAssetRedirectionManager = IAssetRedirectionManager.Stub.asInterface(b);
        return sAssetRedirectionManager;
    }

    /**
     * Attach the necessary theme asset paths and meta information to convert an
     * AssetManager to being globally "theme-aware".
     *
     * @param assets
     * @param theme
     * @return true if the AssetManager is now theme-aware; false otherwise.
     *         This can fail, for example, if the theme package has been been
     *         removed and the theme manager has yet to revert formally back to
     *         the framework default.
     */
    private boolean attachThemeAssets(AssetManager assets, CustomTheme theme) {
        IAssetRedirectionManager rm = getAssetRedirectionManager();
        if (rm == null) {
            return false;
        }
        PackageInfo pi = null;
        try {
            pi = getPackageManager().getPackageInfo(theme.getThemePackageName(), 0, UserHandle.myUserId());
        } catch (RemoteException e) {
        }
        if (pi != null && pi.applicationInfo != null && pi.themeInfos != null) {
            String themeResDir = pi.applicationInfo.publicSourceDir;
            int cookie = assets.attachThemePath(themeResDir);
            if (cookie != 0) {
                String themePackageName = theme.getThemePackageName();
                String themeId = theme.getThemeId();
                int N = assets.getBasePackageCount();
                for (int i = 0; i < N; i++) {
                    String packageName = assets.getBasePackageName(i);
                    int packageId = assets.getBasePackageId(i);

                    /*
                     * For now, we only consider redirections coming from the
                     * framework or regular android packages. This excludes
                     * themes and other specialty APKs we are not aware of.
                     */
                    if (packageId != 0x01 && packageId != 0x7f) {
                        continue;
                    }

                    try {
                        PackageRedirectionMap map = rm.getPackageRedirectionMap(themePackageName, themeId,
                                packageName);
                        if (map != null) {
                            assets.addRedirections(map);
                        }
                    } catch (RemoteException e) {
                        Slog.e(TAG, "Failure accessing package redirection map, removing theme support.");
                        assets.detachThemePath(themePackageName, cookie);
                        return false;
                    }
                }

                assets.setThemePackageName(theme.getThemePackageName());
                assets.setThemeCookie(cookie);
                return true;
            } else {
                Slog.e(TAG, "Unable to attach theme assets at " + themeResDir);
            }
        }
        return false;
    }

    private void detachThemeAssets(AssetManager assets) {
        String themePackageName = assets.getThemePackageName();
        int themeCookie = assets.getThemeCookie();
        if (!TextUtils.isEmpty(themePackageName) && themeCookie != 0) {
            assets.detachThemePath(themePackageName, themeCookie);
            assets.setThemePackageName(null);
            assets.setThemeCookie(0);
            assets.clearRedirections();
        }
        return changes != 0;
    }

}
Loading