Search in sources :

Example 1 with Action

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.

the class DragLayer method onInterceptHoverEvent.

@Override
public boolean onInterceptHoverEvent(MotionEvent ev) {
    if (mActivity == null || mActivity.getWorkspace() == null) {
        return false;
    }
    AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
    if (!(topView instanceof Folder)) {
        return false;
    } else {
        AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (accessibilityManager.isTouchExplorationEnabled()) {
            Folder currentFolder = (Folder) topView;
            final int action = ev.getAction();
            boolean isOverFolderOrSearchBar;
            switch(action) {
                case MotionEvent.ACTION_HOVER_ENTER:
                    isOverFolderOrSearchBar = isEventOverView(topView, ev) || isEventOverAccessibleDropTargetBar(ev);
                    if (!isOverFolderOrSearchBar) {
                        sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                        mHoverPointClosesFolder = true;
                        return true;
                    }
                    mHoverPointClosesFolder = false;
                    break;
                case MotionEvent.ACTION_HOVER_MOVE:
                    isOverFolderOrSearchBar = isEventOverView(topView, ev) || isEventOverAccessibleDropTargetBar(ev);
                    if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) {
                        sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                        mHoverPointClosesFolder = true;
                        return true;
                    } else if (!isOverFolderOrSearchBar) {
                        return true;
                    }
                    mHoverPointClosesFolder = false;
            }
        }
    }
    return false;
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) Folder(com.android.launcher3.folder.Folder) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Example 2 with Action

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherAccessibilityDelegate method performResizeAction.

private boolean performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
    CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
    CellLayout layout = (CellLayout) host.getParent().getParent();
    layout.markCellsAsUnoccupiedForView(host);
    if (action == R.string.action_increase_width) {
        if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
            lp.cellX--;
            info.cellX--;
        }
        lp.cellHSpan++;
        info.spanX++;
    } else if (action == R.string.action_decrease_width) {
        lp.cellHSpan--;
        info.spanX--;
    } else if (action == R.string.action_increase_height) {
        if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
            lp.cellY--;
            info.cellY--;
        }
        lp.cellVSpan++;
        info.spanY++;
    } else if (action == R.string.action_decrease_height) {
        lp.cellVSpan--;
        info.spanY--;
    }
    layout.markCellsAsOccupiedForView(host);
    WidgetSizes.updateWidgetSizeRanges(((LauncherAppWidgetHostView) host), mLauncher, info.spanX, info.spanY);
    host.requestLayout();
    mLauncher.getModelWriter().updateItemInDatabase(info);
    announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
    return true;
}
Also used : CellLayout(com.android.launcher3.CellLayout) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView)

Example 3 with Action

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.

the class AllAppsStore method updateAllIcons.

private void updateAllIcons(Consumer<BubbleTextView> action) {
    for (int i = mIconContainers.size() - 1; i >= 0; i--) {
        ViewGroup parent = mIconContainers.get(i);
        int childCount = parent.getChildCount();
        for (int j = 0; j < childCount; j++) {
            View child = parent.getChildAt(j);
            if (child instanceof BubbleTextView) {
                action.accept((BubbleTextView) child);
            }
        }
    }
}
Also used : ViewGroup(android.view.ViewGroup) BubbleTextView(com.android.launcher3.BubbleTextView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View)

Example 4 with Action

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.

the class DeveloperOptionsFragment method loadPluginPrefs.

private void loadPluginPrefs() {
    if (mPluginsCategory != null) {
        mPreferenceScreen.removePreference(mPluginsCategory);
    }
    if (!PluginManagerWrapper.hasPlugins(getActivity())) {
        mPluginsCategory = null;
        return;
    }
    mPluginsCategory = newCategory("Plugins");
    PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
    Context prefContext = getContext();
    PackageManager pm = getContext().getPackageManager();
    Set<String> pluginActions = manager.getPluginActions();
    ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
    Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
    for (String action : pluginActions) {
        String name = toName(action);
        List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
        for (ResolveInfo info : result) {
            String packageName = info.serviceInfo.packageName;
            if (!pluginPermissionApps.contains(packageName)) {
                continue;
            }
            Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
            if (!plugins.containsKey(key)) {
                plugins.put(key, new ArrayList<>());
            }
            plugins.get(key).add(Pair.create(name, info));
        }
    }
    PreferenceDataStore enabler = manager.getPluginEnabler();
    plugins.forEach((key, si) -> {
        String packageName = key.first;
        List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
        if (!componentNames.isEmpty()) {
            SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
            pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
            mPluginsCategory.addPreference(pref);
        }
    });
}
Also used : Context(android.content.Context) PreferenceGroup(androidx.preference.PreferenceGroup) Context(android.content.Context) Bundle(android.os.Bundle) PackageManager(android.content.pm.PackageManager) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) Pair(android.util.Pair) PreferenceCategory(androidx.preference.PreferenceCategory) Intent(android.content.Intent) PreferenceFragmentCompat(androidx.preference.PreferenceFragmentCompat) Editable(android.text.Editable) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) MenuInflater(android.view.MenuInflater) PreferenceViewHolder(androidx.preference.PreferenceViewHolder) Menu(android.view.Menu) VISIBLE(android.view.View.VISIBLE) View(android.view.View) Settings(android.provider.Settings) Build(android.os.Build) TargetApi(android.annotation.TargetApi) ArrayMap(android.util.ArrayMap) PreferenceScreen(androidx.preference.PreferenceScreen) MATCH_DISABLED_COMPONENTS(android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS) FlagTogglerPrefUi(com.android.launcher3.config.FlagTogglerPrefUi) ComponentName(android.content.ComponentName) SwitchPreference(androidx.preference.SwitchPreference) PLUGIN_CHANGED(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED) IntentFilter(android.content.IntentFilter) GET_RESOLVED_FILTER(android.content.pm.PackageManager.GET_RESOLVED_FILTER) Set(java.util.Set) FeatureFlags(com.android.launcher3.config.FeatureFlags) BroadcastReceiver(android.content.BroadcastReceiver) Preference(androidx.preference.Preference) PluginManagerWrapper(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper) Collectors(java.util.stream.Collectors) PreferenceDataStore(androidx.preference.PreferenceDataStore) ResolveInfo(android.content.pm.ResolveInfo) List(java.util.List) Nullable(androidx.annotation.Nullable) GONE(android.view.View.GONE) R(com.android.launcher3.R) PluginManagerWrapper.pluginEnabledKey(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey) EditText(android.widget.EditText) TextWatcher(android.text.TextWatcher) PreferenceDataStore(androidx.preference.PreferenceDataStore) SwitchPreference(androidx.preference.SwitchPreference) ArrayList(java.util.ArrayList) PluginManagerWrapper(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper) ArrayMap(android.util.ArrayMap) Intent(android.content.Intent) ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) ComponentName(android.content.ComponentName) Pair(android.util.Pair)

Example 5 with Action

use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.

the class StartLauncherViaGestureTests method runTest.

private void runTest(String... eventSequence) {
    final RaceConditionReproducer eventProcessor = new RaceConditionReproducer(eventSequence);
    // Destroy Launcher activity.
    closeLauncherActivity();
    // The test action.
    eventProcessor.startIteration();
    mLauncher.pressHome();
    eventProcessor.finishIteration();
}
Also used : RaceConditionReproducer(com.android.launcher3.util.RaceConditionReproducer)

Aggregations

Rect (android.graphics.Rect)20 ArrayList (java.util.ArrayList)18 LauncherEvent (com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent)16 View (android.view.View)14 CellLayout (com.android.launcher3.CellLayout)14 Folder (com.android.launcher3.folder.Folder)14 LoggerUtils.newLauncherEvent (com.android.launcher3.logging.LoggerUtils.newLauncherEvent)14 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)12 Point (android.graphics.Point)11 Action (com.android.launcher3.userevent.nano.LauncherLogProto.Action)10 Intent (android.content.Intent)9 Context (android.content.Context)8 PackageManager (android.content.pm.PackageManager)8 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)8 DragLayer (com.android.launcher3.dragndrop.DragLayer)8 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)8 BubbleTextView (com.android.launcher3.BubbleTextView)7 DeviceProfile (com.android.launcher3.DeviceProfile)7 NotificationMainView (com.android.launcher3.notification.NotificationMainView)6 DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)6