Search in sources :

Example 1 with RecentsPackageMonitor

use of com.android.systemui.recents.model.RecentsPackageMonitor in project platform_frameworks_base by android.

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 2 with RecentsPackageMonitor

use of com.android.systemui.recents.model.RecentsPackageMonitor in project platform_frameworks_base by android.

the class RecentsActivity method onCreate.

/** Called with the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    // Initialize the package monitor
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents);
    takeKeyEvents(true);
    mRecentsView = (RecentsView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mScrimViews = new SystemBarScrimViews(this);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    Configuration appConfiguration = Utilities.getAppConfiguration(this);
    mLastDeviceOrientation = appConfiguration.orientation;
    mLastDisplayDensity = appConfiguration.densityDpi;
    mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration);
    mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() {

        @Override
        public void run() {
            dismissRecentsToFocusedTask(MetricsEvent.OVERVIEW_SELECT_TIMEOUT);
        }
    });
    // Set the window background
    getWindow().setBackgroundDrawable(mRecentsView.getBackgroundScrim());
    // Create the home intent runnable
    mHomeIntent = new Intent(Intent.ACTION_MAIN, null);
    mHomeIntent.addCategory(Intent.CATEGORY_HOME);
    mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    // Register the broadcast receiver to handle messages when the screen is turned off
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_SCREEN_OFF);
    filter.addAction(Intent.ACTION_TIME_CHANGED);
    registerReceiver(mSystemBroadcastReceiver, filter);
    getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
    // Reload the stack view
    reloadStackView();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) IntentFilter(android.content.IntentFilter) SystemBarScrimViews(com.android.systemui.recents.views.SystemBarScrimViews) Configuration(android.content.res.Configuration) DozeTrigger(com.android.systemui.recents.misc.DozeTrigger) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 3 with RecentsPackageMonitor

use of com.android.systemui.recents.model.RecentsPackageMonitor in project android_frameworks_base by DirtyUnicorns.

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 4 with RecentsPackageMonitor

use of com.android.systemui.recents.model.RecentsPackageMonitor in project android_frameworks_base by AOSPA.

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 5 with RecentsPackageMonitor

use of com.android.systemui.recents.model.RecentsPackageMonitor in project android_frameworks_base by ResurrectionRemix.

the class RecentsActivity method onCreate.

/** Called with the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    // Initialize the package monitor
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents);
    takeKeyEvents(true);
    mRecentsView = (RecentsView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mScrimViews = new SystemBarScrimViews(this);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    Configuration appConfiguration = Utilities.getAppConfiguration(this);
    mLastDeviceOrientation = appConfiguration.orientation;
    mLastDisplayDensity = appConfiguration.densityDpi;
    mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration);
    mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() {

        @Override
        public void run() {
            dismissRecentsToFocusedTask(MetricsEvent.OVERVIEW_SELECT_TIMEOUT);
        }
    });
    // Set the window background
    getWindow().setBackgroundDrawable(mRecentsView.getBackgroundScrim());
    // Create the home intent runnable
    mHomeIntent = new Intent(Intent.ACTION_MAIN, null);
    mHomeIntent.addCategory(Intent.CATEGORY_HOME);
    mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    // Register the broadcast receiver to handle messages when the screen is turned off
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_SCREEN_OFF);
    filter.addAction(Intent.ACTION_TIME_CHANGED);
    registerReceiver(mSystemBroadcastReceiver, filter);
    getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
    // Reload the stack view
    reloadStackView();
    try {
        RecentsView mRecentsView = (RecentsView) getObjectField(this, "mRecentsView");
        mRecentsActivityRootView = (FrameLayout) mRecentsView.getParent();
        Bitmap lastBlurredBitmap = BlurTask.getLastBlurredBitmap();
        if ((mBlurredRecentAppsEnabled) && (lastBlurredBitmap != null)) {
            BitmapDrawable blurredDrawable = new BitmapDrawable(lastBlurredBitmap);
            blurredDrawable.setColorFilter(mColorFilter);
            mRecentsActivityRootView.setBackground(blurredDrawable);
        }
    } catch (Exception e) {
    }
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) IntentFilter(android.content.IntentFilter) SystemBarScrimViews(com.android.systemui.recents.views.SystemBarScrimViews) Configuration(android.content.res.Configuration) DozeTrigger(com.android.systemui.recents.misc.DozeTrigger) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) RecentsView(com.android.systemui.recents.views.RecentsView) Intent(android.content.Intent) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Aggregations

Intent (android.content.Intent)10 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)10 RecentsPackageMonitor (com.android.systemui.recents.model.RecentsPackageMonitor)10 IntentFilter (android.content.IntentFilter)5 Configuration (android.content.res.Configuration)5 Rect (android.graphics.Rect)5 LayoutParams (android.widget.FrameLayout.LayoutParams)5 DozeTrigger (com.android.systemui.recents.misc.DozeTrigger)5 SystemBarScrimViews (com.android.systemui.recents.views.SystemBarScrimViews)5 BitmapDrawable (android.graphics.drawable.BitmapDrawable)2 RecentsView (com.android.systemui.recents.views.RecentsView)2