package com.droiddeck.launcher import android.app.Activity import android.content.Intent import android.os.Bundle import com.droiddeck.launcher.session.SessionService /** Receives the system Home launch and routes it without consuming KEYCODE_HOME. */ class HomeActivity : Activity() { override fun attachBaseContext(newBase: android.content.Context) { super.attachBaseContext(newBase) com.droiddeck.launcher.core.AppLanguage.applyTo(this, newBase) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) routeHome() } private fun routeHome() { val destination = if (HomeApp.isActiveSteamSession()) { Intent(this, SessionActivity::class.java) .setAction(SessionService.ACTION_HOME_GUIDE) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) } else { Intent(this, MainActivity::class.java) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) } startActivity(destination) finish() } }