Skip to content

Commit

Permalink
base: introduce GameSpace
Browse files Browse the repository at this point in the history
Signed-off-by: jhonboy121 <alfredmathew05@gmail.com>
  • Loading branch information
jhonboy121 committed Jun 25, 2022
1 parent bd558dc commit 348dc95
Show file tree
Hide file tree
Showing 13 changed files with 845 additions and 4 deletions.
40 changes: 40 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -5637,6 +5637,46 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String VOLUME_PANEL_ON_LEFT = "volume_panel_on_left";

/**
* Whether GameSpace is enabled.
* Default 0.
* @hide
*/
@Readable
public static final String GAMESPACE_ENABLED = "gamespace_enabled";

/**
* A list of user selected package names delimited by ';' for game mode.
* @hide
*/
@Readable
public static final String GAMESPACE_PACKAGE_LIST = "gamespace_package_list";

/**
* Whether game mode should be launched when opened apps are games and are not in
* selected packages list.
* Default 1.
* @hide
*/
@Readable
public static final String GAMESPACE_DYNAMIC_MODE = "gamespace_dynamic_mode";

/**
* Whether HUNs should be disabled in game mode.
* Default 1.
* @hide
*/
@Readable
public static final String GAMESPACE_DISABLE_HEADSUP = "gamespace_disable_headsup";

/**
* Whether fullscreen intents (for ex: call screen) should be suppressed in game mode.
* Default 0.
* @hide
*/
@Readable
public static final String GAMESPACE_DISABLE_FULLSCREEN_INTENT = "gamespace_disable_fullscreen_intent";

/**
* IMPORTANT: If you add a new public settings you also have to add it to
* PUBLIC_SETTINGS below. If the new setting is hidden you have to add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ protected boolean isEntryValid(String entry) {

@Override
protected boolean isItemValid(String item) {
return PACKAGE_NAME_VALIDATOR.validate(item);
return item.isEmpty() || PACKAGE_NAME_VALIDATOR.validate(item);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package android.provider.settings.validators;

import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.APP_LIST_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.COMPONENT_NAME_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.GAMING_MODE_PACKAGE_LIST_VALIDATOR;
Expand Down Expand Up @@ -310,6 +311,11 @@ public boolean validate(String value) {
VALIDATORS.put(System.QQS_SHOW_BRIGHTNESS, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.SHOW_AUTO_BRIGHTNESS_BUTTON, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.BRIGHTNESS_SLIDER_POSITION, new InclusiveIntegerRangeValidator(0, 1));
VALIDATORS.put(System.VOLUME_PANEL_ON_LEFT, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.VOLUME_PANEL_ON_LEFT, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.GAMESPACE_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.GAMESPACE_PACKAGE_LIST, APP_LIST_VALIDATOR);
VALIDATORS.put(System.GAMESPACE_DYNAMIC_MODE, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.GAMESPACE_DISABLE_HEADSUP, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.GAMESPACE_DISABLE_FULLSCREEN_INTENT, BOOLEAN_VALIDATOR);
}
}
5 changes: 5 additions & 0 deletions packages/SystemUI/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@
<protected-broadcast android:name="com.google.android.systemui.smartspace.ENABLE_UPDATE"/>
<protected-broadcast android:name="com.google.android.systemui.smartspace.EXPIRE_EVENT"/>

<permission
android:name="com.flamingo.permission.MANAGE_GAMESPACE"
android:protectionLevel="signature|privileged" />
<uses-permission android:name="com.flamingo.permission.MANAGE_GAMESPACE" />

<application
android:name=".SystemUIApplication"
android:persistent="true"
Expand Down
1 change: 1 addition & 0 deletions packages/SystemUI/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
<item>com.android.systemui.accessibility.SystemActions</item>
<item>com.android.systemui.toast.ToastUI</item>
<item>com.android.systemui.wmshell.WMShell</item>
<item>com.android.systemui.statusbar.phone.GameSpaceServiceDelegate</item>
</string-array>

<!-- QS tile shape store width. negative implies fill configuration instead of stroke-->
Expand Down
3 changes: 3 additions & 0 deletions packages/SystemUI/res/values/flamingo_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@

<!-- Allow devices override audio panel location to the left side -->
<bool name="config_audioPanelOnLeftSide">false</bool>

<!-- GameSpace service component that will be bound with SystemUI for game mode -->
<string name="config_gameSpaceServiceComponent" />
</resources>
2 changes: 1 addition & 1 deletion packages/SystemUI/shared/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
package="com.android.systemui.shared">


</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2022 FlamingoOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.systemui.statusbar.phone

// Setting defaults
const val DEFAULT_GAMESPACE_ENABLED = false
const val DEFAULT_GAMESPACE_DYNAMIC_MODE = true
const val DEFAULT_GAMESPACE_DISABLE_HEADSUP = true
const val DEFAULT_GAMESPACE_DISABLE_FULLSCREEN_INTENT = false

// State config keys
const val CONFIG_BACK_GESTURE_LOCKED = "back_gesture_locked"
const val CONFIG_RINGER_MODE = "ringer_mode"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 FlamingoOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.systemui.statusbar.phone;

import android.os.Bundle;

import com.android.systemui.statusbar.phone.IGameSpaceServiceCallback;

/**
* @hide
*/
interface IGameSpaceService {
oneway void showGameUI(in String packageName);
oneway void onGamePackageChanged(in String packageName);
oneway void setCallback(in IGameSpaceServiceCallback callback);
oneway void onStateChanged(in Bundle state);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 FlamingoOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.systemui.statusbar.phone;

/**
* @hide
*/
interface IGameSpaceServiceCallback {
oneway void setGesturalNavigationLocked(in boolean isLocked);
oneway void setRingerMode(in int mode);
oneway void setAdaptiveBrightnessDisabled(in boolean disabled);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.android.systemui.shortcut.ShortcutKeyDispatcher;
import com.android.systemui.statusbar.dagger.StatusBarModule;
import com.android.systemui.statusbar.notification.InstantAppNotifier;
import com.android.systemui.statusbar.phone.GameSpaceServiceDelegate;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.tv.TvStatusBar;
import com.android.systemui.statusbar.tv.notifications.TvNotificationPanel;
Expand Down Expand Up @@ -191,4 +192,10 @@ public abstract class SystemUIBinder {
@IntoMap
@ClassKey(HomeSoundEffectController.class)
public abstract SystemUI bindHomeSoundEffectController(HomeSoundEffectController sysui);

/** Inject into GameSpaceServiceDelegate. */
@Binds
@IntoMap
@ClassKey(GameSpaceServiceDelegate.class)
public abstract SystemUI bindGameSpaceServiceDelegate(GameSpaceServiceDelegate sysui);
}
Loading

0 comments on commit 348dc95

Please sign in to comment.