Search in sources :

Example 6 with ArraySet

use of android.util.ArraySet in project platform_frameworks_base by android.

the class NotificationController method updateNotifications.

/**
     * Update notifications for the given print jobs, remove all other notifications.
     *
     * @param printJobs The print job that we want to create notifications for.
     */
private void updateNotifications(List<PrintJobInfo> printJobs) {
    ArraySet<PrintJobId> removedPrintJobs = new ArraySet<>(mNotifications);
    final int numPrintJobs = printJobs.size();
    // Create summary notification
    if (numPrintJobs > 1) {
        createStackedNotification(printJobs);
    } else {
        mNotificationManager.cancel(PRINT_JOB_NOTIFICATION_SUMMARY, 0);
    }
    // Create per print job notification
    for (int i = 0; i < numPrintJobs; i++) {
        PrintJobInfo printJob = printJobs.get(i);
        PrintJobId printJobId = printJob.getId();
        removedPrintJobs.remove(printJobId);
        mNotifications.add(printJobId);
        createSimpleNotification(printJob);
    }
    // Remove notifications for print jobs that do not exist anymore
    final int numRemovedPrintJobs = removedPrintJobs.size();
    for (int i = 0; i < numRemovedPrintJobs; i++) {
        PrintJobId removedPrintJob = removedPrintJobs.valueAt(i);
        mNotificationManager.cancel(removedPrintJob.flattenToString(), 0);
        mNotifications.remove(removedPrintJob);
    }
}
Also used : ArraySet(android.util.ArraySet) PrintJobId(android.print.PrintJobId) PrintJobInfo(android.print.PrintJobInfo)

Example 7 with ArraySet

use of android.util.ArraySet in project platform_frameworks_base by android.

the class TransformState method setClippingDeactivated.

public static void setClippingDeactivated(final View transformedView, boolean deactivated) {
    if (!(transformedView.getParent() instanceof ViewGroup)) {
        return;
    }
    ViewGroup view = (ViewGroup) transformedView.getParent();
    while (true) {
        ArraySet<View> clipSet = (ArraySet<View>) view.getTag(CLIP_CLIPPING_SET);
        if (clipSet == null) {
            clipSet = new ArraySet<>();
            view.setTag(CLIP_CLIPPING_SET, clipSet);
        }
        Boolean clipChildren = (Boolean) view.getTag(CLIP_CHILDREN_TAG);
        if (clipChildren == null) {
            clipChildren = view.getClipChildren();
            view.setTag(CLIP_CHILDREN_TAG, clipChildren);
        }
        Boolean clipToPadding = (Boolean) view.getTag(CLIP_TO_PADDING);
        if (clipToPadding == null) {
            clipToPadding = view.getClipToPadding();
            view.setTag(CLIP_TO_PADDING, clipToPadding);
        }
        ExpandableNotificationRow row = view instanceof ExpandableNotificationRow ? (ExpandableNotificationRow) view : null;
        if (!deactivated) {
            clipSet.remove(transformedView);
            if (clipSet.isEmpty()) {
                view.setClipChildren(clipChildren);
                view.setClipToPadding(clipToPadding);
                view.setTag(CLIP_CLIPPING_SET, null);
                if (row != null) {
                    row.setClipToActualHeight(true);
                }
            }
        } else {
            clipSet.add(transformedView);
            view.setClipChildren(false);
            view.setClipToPadding(false);
            if (row != null && row.isChildInGroup()) {
                // We still want to clip to the parent's height
                row.setClipToActualHeight(false);
            }
        }
        if (row != null && !row.isChildInGroup()) {
            return;
        }
        final ViewParent parent = view.getParent();
        if (parent instanceof ViewGroup) {
            view = (ViewGroup) parent;
        } else {
            return;
        }
    }
}
Also used : ArraySet(android.util.ArraySet) ViewGroup(android.view.ViewGroup) ViewParent(android.view.ViewParent) ImageView(android.widget.ImageView) TransformableView(com.android.systemui.statusbar.TransformableView) TextView(android.widget.TextView) View(android.view.View) NotificationHeaderView(android.view.NotificationHeaderView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 8 with ArraySet

use of android.util.ArraySet in project platform_frameworks_base by android.

the class FullBackup method getBackupSchemeForTest.

public static BackupScheme getBackupSchemeForTest(Context context) {
    BackupScheme testing = new BackupScheme(context);
    testing.mExcludes = new ArraySet();
    testing.mIncludes = new ArrayMap();
    return testing;
}
Also used : ArraySet(android.util.ArraySet) ArrayMap(android.util.ArrayMap)

Example 9 with ArraySet

use of android.util.ArraySet in project platform_frameworks_base by android.

the class InputMethodUtils method parseInputMethodsAndSubtypesString.

/**
     * Parses the setting stored input methods and subtypes string value.
     *
     * @param inputMethodsAndSubtypesString The input method subtypes value stored in settings.
     * @return Map from input method ID to set of input method subtypes IDs.
     */
@VisibleForTesting
public static ArrayMap<String, ArraySet<String>> parseInputMethodsAndSubtypesString(@Nullable final String inputMethodsAndSubtypesString) {
    final ArrayMap<String, ArraySet<String>> imeMap = new ArrayMap<>();
    if (TextUtils.isEmpty(inputMethodsAndSubtypesString)) {
        return imeMap;
    }
    final SimpleStringSplitter typeSplitter = new SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
    final SimpleStringSplitter subtypeSplitter = new SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
    List<Pair<String, ArrayList<String>>> allImeSettings = InputMethodSettings.buildInputMethodsAndSubtypeList(inputMethodsAndSubtypesString, typeSplitter, subtypeSplitter);
    for (Pair<String, ArrayList<String>> ime : allImeSettings) {
        ArraySet<String> subtypes = new ArraySet<>();
        if (ime.second != null) {
            subtypes.addAll(ime.second);
        }
        imeMap.put(ime.first, subtypes);
    }
    return imeMap;
}
Also used : ArraySet(android.util.ArraySet) ArrayList(java.util.ArrayList) ArrayMap(android.util.ArrayMap) SimpleStringSplitter(android.text.TextUtils.SimpleStringSplitter) Pair(android.util.Pair) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Example 10 with ArraySet

use of android.util.ArraySet in project platform_frameworks_base by android.

the class ActivityManagerService method finishBooting.

final void finishBooting() {
    synchronized (this) {
        if (!mBootAnimationComplete) {
            mCallFinishBooting = true;
            return;
        }
        mCallFinishBooting = false;
    }
    ArraySet<String> completedIsas = new ArraySet<String>();
    for (String abi : Build.SUPPORTED_ABIS) {
        Process.zygoteProcess.establishZygoteConnectionForAbi(abi);
        final String instructionSet = VMRuntime.getInstructionSet(abi);
        if (!completedIsas.contains(instructionSet)) {
            try {
                mInstaller.markBootComplete(VMRuntime.getInstructionSet(abi));
            } catch (InstallerException e) {
                Slog.w(TAG, "Unable to mark boot complete for abi: " + abi + " (" + e.getMessage() + ")");
            }
            completedIsas.add(instructionSet);
        }
    }
    IntentFilter pkgFilter = new IntentFilter();
    pkgFilter.addAction(Intent.ACTION_QUERY_PACKAGE_RESTART);
    pkgFilter.addDataScheme("package");
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String[] pkgs = intent.getStringArrayExtra(Intent.EXTRA_PACKAGES);
            if (pkgs != null) {
                for (String pkg : pkgs) {
                    synchronized (ActivityManagerService.this) {
                        if (forceStopPackageLocked(pkg, -1, false, false, false, false, false, 0, "query restart")) {
                            setResultCode(Activity.RESULT_OK);
                            return;
                        }
                    }
                }
            }
        }
    }, pkgFilter);
    IntentFilter dumpheapFilter = new IntentFilter();
    dumpheapFilter.addAction(DumpHeapActivity.ACTION_DELETE_DUMPHEAP);
    mContext.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getBooleanExtra(DumpHeapActivity.EXTRA_DELAY_DELETE, false)) {
                mHandler.sendEmptyMessageDelayed(POST_DUMP_HEAP_NOTIFICATION_MSG, 5 * 60 * 1000);
            } else {
                mHandler.sendEmptyMessage(POST_DUMP_HEAP_NOTIFICATION_MSG);
            }
        }
    }, dumpheapFilter);
    // Let system services know.
    mSystemServiceManager.startBootPhase(SystemService.PHASE_BOOT_COMPLETED);
    synchronized (this) {
        // Ensure that any processes we had put on hold are now started
        // up.
        final int NP = mProcessesOnHold.size();
        if (NP > 0) {
            ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(mProcessesOnHold);
            for (int ip = 0; ip < NP; ip++) {
                if (DEBUG_PROCESSES)
                    Slog.v(TAG_PROCESSES, "Starting process on hold: " + procs.get(ip));
                startProcessLocked(procs.get(ip), "on-hold", null);
            }
        }
        if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
            // Start looking for apps that are abusing wake locks.
            Message nmsg = mHandler.obtainMessage(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
            mHandler.sendMessageDelayed(nmsg, POWER_CHECK_DELAY);
            // Tell anyone interested that we are done booting!
            SystemProperties.set("sys.boot_completed", "1");
            // And trigger dev.bootcomplete if we are not showing encryption progress
            if (!"trigger_restart_min_framework".equals(SystemProperties.get("vold.decrypt")) || "".equals(SystemProperties.get("vold.encrypt_progress"))) {
                SystemProperties.set("dev.bootcomplete", "1");
            }
            mUserController.sendBootCompletedLocked(new IIntentReceiver.Stub() {

                @Override
                public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
                    synchronized (ActivityManagerService.this) {
                        requestPssAllProcsLocked(SystemClock.uptimeMillis(), true, false);
                    }
                }
            });
            scheduleStartProfilesLocked();
        }
    }
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) ArraySet(android.util.ArraySet) Message(android.os.Message) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) Point(android.graphics.Point) IIntentReceiver(android.content.IIntentReceiver) InstallerException(com.android.server.pm.Installer.InstallerException)

Aggregations

ArraySet (android.util.ArraySet)431 PublicKey (java.security.PublicKey)94 ComponentName (android.content.ComponentName)73 ArrayMap (android.util.ArrayMap)73 ArrayList (java.util.ArrayList)66 Pair (android.util.Pair)47 File (java.io.File)33 SSLContext (javax.net.ssl.SSLContext)32 Intent (android.content.Intent)30 RemoteException (android.os.RemoteException)29 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)28 ResolveInfo (android.content.pm.ResolveInfo)25 Point (android.graphics.Point)24 IOException (java.io.IOException)23 UserInfo (android.content.pm.UserInfo)21 X509Certificate (java.security.cert.X509Certificate)20 ContentResolver (android.content.ContentResolver)16 PackageManager (android.content.pm.PackageManager)15 NetworkPolicyManager.uidRulesToString (android.net.NetworkPolicyManager.uidRulesToString)15 SparseArray (android.util.SparseArray)15