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

Commit dd5f21e8 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8076550 from 9c297221 to sc-v2-release

Change-Id: Ib0cba67589d4d7f9b21d7c6127497c6b8fc5d836
parents 2f398e90 9c297221
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2679,6 +2679,16 @@
        <item>350</item>
    </integer-array>

    <!-- A vibration waveform for notifications that specify DEFAULT_VIBRATE.
         This value is a float array with values grouped as
         { targetAmplitude (within [0,1]), targetFrequency [-1,1], duration (in milliseconds) }
         This is only applied on devices with vibration frequency control. If the device doesn't
         support frequency control, then the vibration specified in
         config_defaultNotificationVibePattern is used instead.
     -->
    <array name="config_defaultNotificationVibeWaveform">
    </array>

    <!-- Vibrator pattern to be used as the default for notifications
         that do not specify vibration but vibrate anyway because the device
         is in vibrate mode.
@@ -2690,6 +2700,16 @@
        <item>100</item>
    </integer-array>

    <!-- A vibration waveform for notifications that do not specify vibration but vibrate anyway,
         because the device is in vibrate mode. This value is a float array with values grouped as
         { targetAmplitude (within [0,1]), targetFrequency [-1,1], duration (in milliseconds) }
         This is only applied on devices with vibration frequency control. If the device doesn't
         support frequency control, then the vibration specified in
         config_notificationFallbackVibePattern is used instead.
     -->
    <array name="config_notificationFallbackVibeWaveform">
    </array>

    <!-- Flag indicating if the speed up audio on mt call code should be executed -->
    <bool name="config_speed_up_audio_on_mt_calls">false</bool>

+2 −0
Original line number Diff line number Diff line
@@ -1917,7 +1917,9 @@
  <java-symbol type="array" name="config_locationExtraPackageNames" />
  <java-symbol type="array" name="config_testLocationProviders" />
  <java-symbol type="array" name="config_defaultNotificationVibePattern" />
  <java-symbol type="array" name="config_defaultNotificationVibeWaveform" />
  <java-symbol type="array" name="config_notificationFallbackVibePattern" />
  <java-symbol type="array" name="config_notificationFallbackVibeWaveform" />
  <java-symbol type="bool" name="config_enableServerNotificationEffectsForAutomotive" />
  <java-symbol type="bool" name="config_useAttentionLight" />
  <java-symbol type="bool" name="config_adaptive_sleep_available" />
+10 −9
Original line number Diff line number Diff line
@@ -79,22 +79,23 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
    }

    @Override
    public void registerOrganizer() {
        if (mAnimationController != null) {
            throw new IllegalStateException("Must unregister the organizer before re-register.");
    public void unregisterOrganizer() {
        stopOverrideSplitAnimation();
        mAnimationController = null;
        super.unregisterOrganizer();
    }
        super.registerOrganizer();

    void startOverrideSplitAnimation() {
        if (mAnimationController == null) {
            mAnimationController = new TaskFragmentAnimationController(this);
        }
        mAnimationController.registerRemoteAnimations();
    }

    @Override
    public void unregisterOrganizer() {
    void stopOverrideSplitAnimation() {
        if (mAnimationController != null) {
            mAnimationController.unregisterRemoteAnimations();
            mAnimationController = null;
        }
        super.unregisterOrganizer();
    }

    /**
+59 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -63,6 +64,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    private @NonNull Consumer<List<SplitInfo>> mEmbeddingCallback;
    private final List<SplitInfo> mLastReportedSplitStates = new ArrayList<>();

    // We currently only support split activity embedding within the one root Task.
    private final Rect mParentBounds = new Rect();

    public SplitController() {
        mPresenter = new SplitPresenter(new MainThreadExecutor(), this);
        ActivityThread activityThread = ActivityThread.currentActivityThread();
@@ -79,6 +83,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    public void setEmbeddingRules(@NonNull Set<EmbeddingRule> rules) {
        mSplitRules.clear();
        mSplitRules.addAll(rules);
        updateAnimationOverride();
    }

    @NonNull
@@ -158,6 +163,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    @Override
    public void onTaskFragmentParentInfoChanged(@NonNull IBinder fragmentToken,
            @NonNull Configuration parentConfig) {
        onParentBoundsMayChange(parentConfig.windowConfiguration.getBounds());
        TaskFragmentContainer container = getContainer(fragmentToken);
        if (container != null) {
            mPresenter.updateContainer(container);
@@ -165,6 +171,51 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
        }
    }

    private void onParentBoundsMayChange(Activity activity) {
        if (activity.isFinishing()) {
            return;
        }

        onParentBoundsMayChange(mPresenter.getParentContainerBounds(activity));
    }

    private void onParentBoundsMayChange(Rect parentBounds) {
        if (!parentBounds.isEmpty() && !mParentBounds.equals(parentBounds)) {
            mParentBounds.set(parentBounds);
            updateAnimationOverride();
        }
    }

    /**
     * Updates if we should override transition animation. We only want to override if the Task
     * bounds is large enough for at least one split rule.
     */
    private void updateAnimationOverride() {
        if (mParentBounds.isEmpty()) {
            // We don't know about the parent bounds yet.
            return;
        }

        // Check if the parent container bounds can support any split rule.
        boolean supportSplit = false;
        for (EmbeddingRule rule : mSplitRules) {
            if (!(rule instanceof SplitRule)) {
                continue;
            }
            if (mPresenter.shouldShowSideBySide(mParentBounds, (SplitRule) rule)) {
                supportSplit = true;
                break;
            }
        }

        // We only want to override if it supports split.
        if (supportSplit) {
            mPresenter.startOverrideSplitAnimation();
        } else {
            mPresenter.stopOverrideSplitAnimation();
        }
    }

    void onActivityCreated(@NonNull Activity launchedActivity) {
        handleActivityCreated(launchedActivity);
        updateCallbackIfNecessary();
@@ -180,6 +231,11 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
        final TaskFragmentContainer currentContainer = getContainerWithActivity(
                launchedActivity.getActivityToken());

        if (currentContainer == null) {
            // Initial check before any TaskFragment is created.
            onParentBoundsMayChange(launchedActivity);
        }

        // Check if the activity is configured to always be expanded.
        if (shouldExpand(launchedActivity, null, splitRules)) {
            if (shouldContainerBeExpanded(currentContainer)) {
@@ -257,6 +313,8 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
            // onTaskFragmentParentInfoChanged
            return;
        }
        // The bounds of the container may have been changed.
        onParentBoundsMayChange(activity);

        // Check if activity requires a placeholder
        launchPlaceholderIfNecessary(activity);
@@ -346,7 +404,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    TaskFragmentContainer getTopActiveContainer() {
        for (int i = mContainers.size() - 1; i >= 0; i--) {
            TaskFragmentContainer container = mContainers.get(i);
            if (!container.isFinished()) {
            if (!container.isFinished() && container.getTopNonFinishingActivity() != null) {
                return container;
            }
        }
+21 −11
Original line number Diff line number Diff line
@@ -37,32 +37,42 @@ class TaskFragmentAnimationController {

    private final TaskFragmentOrganizer mOrganizer;
    private final TaskFragmentAnimationRunner mRemoteRunner = new TaskFragmentAnimationRunner();
    private final RemoteAnimationDefinition mDefinition;
    private boolean mIsRegister;

    TaskFragmentAnimationController(TaskFragmentOrganizer organizer) {
        mOrganizer = organizer;
        mDefinition = new RemoteAnimationDefinition();
        final RemoteAnimationAdapter animationAdapter =
                new RemoteAnimationAdapter(mRemoteRunner, 0, 0, true /* changeNeedsSnapshot */);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_ACTIVITY_OPEN, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_OPEN, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_TASK_OPEN, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_ACTIVITY_CLOSE, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_CLOSE, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_TASK_CLOSE, animationAdapter);
        mDefinition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_CHANGE, animationAdapter);
    }

    void registerRemoteAnimations() {
        if (DEBUG) {
            Log.v(TAG, "registerRemoteAnimations");
        }
        final RemoteAnimationDefinition definition = new RemoteAnimationDefinition();
        final RemoteAnimationAdapter animationAdapter =
                new RemoteAnimationAdapter(mRemoteRunner, 0, 0, true /* changeNeedsSnapshot */);
        definition.addRemoteAnimation(TRANSIT_OLD_ACTIVITY_OPEN, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_OPEN, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_TASK_OPEN, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_ACTIVITY_CLOSE, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_CLOSE, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_TASK_CLOSE, animationAdapter);
        definition.addRemoteAnimation(TRANSIT_OLD_TASK_FRAGMENT_CHANGE, animationAdapter);
        mOrganizer.registerRemoteAnimations(definition);
        if (mIsRegister) {
            return;
        }
        mOrganizer.registerRemoteAnimations(mDefinition);
        mIsRegister = true;
    }

    void unregisterRemoteAnimations() {
        if (DEBUG) {
            Log.v(TAG, "unregisterRemoteAnimations");
        }
        if (!mIsRegister) {
            return;
        }
        mOrganizer.unregisterRemoteAnimations();
        mIsRegister = false;
    }
}
Loading