Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 14 additions & 69 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,31 @@ android {

compileSdk 34

namespace 'com.limelight'
namespace 'com.winhanced.wincaster'

defaultConfig {
minSdk 21
targetSdk 34

versionName "12.1"
versionCode = 314
applicationId "com.winhanced.wincaster"

versionName "1.0.0"
versionCode = 1

// Generate native debug symbols to allow Google Play to symbolicate our native crashes
ndk.debugSymbolLevel = 'FULL'
}

flavorDimensions.add("root")

buildFeatures {
buildConfig = true
}

productFlavors {
root {
// Android O has native mouse capture, so don't show the rooted
// version to devices running O on the Play Store.
maxSdk 25

externalNativeBuild {
ndkBuild {
arguments "PRODUCT_FLAVOR=root"
}
externalNativeBuild {
ndkBuild {
arguments "PRODUCT_FLAVOR=nonRoot"
}

applicationId "com.limelight.root"
dimension "root"
buildConfigField "boolean", "ROOT_BUILD", "true"
}

nonRoot {
externalNativeBuild {
ndkBuild {
arguments "PRODUCT_FLAVOR=nonRoot"
}
}
buildConfigField "boolean", "ROOT_BUILD", "false"
}

applicationId "com.limelight"
dimension "root"
buildConfigField "boolean", "ROOT_BUILD", "false"
}
buildFeatures {
buildConfig = true
}

compileOptions {
Expand Down Expand Up @@ -82,46 +60,13 @@ android {
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue "string", "app_label", "Moonlight (Debug)"
resValue "string", "app_label_root", "Moonlight (Root Debug)"
resValue "string", "app_label", "WinCaster (Debug)"

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
// To whomever is releasing/using an APK in release mode with
// Moonlight's official application ID, please stop. I see every
// single one of your crashes in my Play Console and it makes
// Moonlight's reliability look worse and makes it more difficult
// to distinguish real crashes from your crashy VR app. Seriously,
// 44 of the *same* native crash in 72 hours and a few each of
// several other crashes.
//
// This is technically not your fault. I would have hoped Google
// would validate the signature of the APK before attributing
// the crash to it. I asked their Play Store support about this
// and they said they don't and don't have plans to, so that sucks.
//
// In any case, it's bad form to release an APK using someone
// else's application ID. There is no legitimate reason, that
// anyone would need to comment out the following line, except me
// when I release an official signed Moonlight build. If you feel
// like doing so would solve something, I can tell you it will not.
// You can't upgrade an app while retaining data without having the
// same signature as the official version. Nor can you post it on
// the Play Store, since that application ID is already taken.
// Reputable APK hosting websites similarly validate the signature
// is consistent with the Play Store and won't allow an APK that
// isn't signed the same as the original.
//
// I wish any and all people using Moonlight as the basis of other
// cool projects the best of luck with their efforts. All I ask
// is to please change the applicationId before you publish.
//
// TL;DR: Leave the following line alone!
applicationIdSuffix ".unofficial"
resValue "string", "app_label", "Moonlight"
resValue "string", "app_label_root", "Moonlight (Root)"
resValue "string", "app_label", "WinCaster"

minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down
43 changes: 43 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA"/>
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA"/>

<!-- WinCaster remote control permissions -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<!-- We don't need a MulticastLock on API level 34+ because we use NsdManager for mDNS -->
<uses-permission
android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
Expand Down Expand Up @@ -177,6 +182,44 @@
android:name=".binding.input.driver.UsbDriverService"
android:label="Usb Driver Service" />

<!-- WinCaster Remote Control Service -->
<service
android:name=".wincaster.WinCasterCommandService"
android:label="WinCaster Remote Control Service"
android:exported="false"
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Remote control listener for Winhanced companion app" />
</service>

<!-- WinCaster Boot Receiver -->
<receiver
android:name=".wincaster.WinCasterBootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>

<!-- WinCaster Deep Link Handler -->
<activity
android:name=".wincaster.WinCasterDeepLinkActivity"
android:exported="true"
android:noHistory="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wincaster" />
</intent-filter>
</activity>

<activity
android:name=".HelpActivity"
android:resizeableActivity="true"
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/com/limelight/PcView.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.limelight.utils.ServerHelper;
import com.limelight.utils.ShortcutHelper;
import com.limelight.utils.UiHelper;
import com.limelight.wincaster.WinCasterAdvertiser;
import com.limelight.wincaster.WinCasterCommandService;

import android.app.Activity;
import android.app.ActivityManager;
Expand Down Expand Up @@ -65,6 +67,7 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
private ShortcutHelper shortcutHelper;
private ComputerManagerService.ComputerManagerBinder managerBinder;
private boolean freezeUpdates, runningPolling, inForeground, completeOnCreateCalled;
private WinCasterAdvertiser winCasterAdvertiser;
private final ServiceConnection serviceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
final ComputerManagerService.ComputerManagerBinder localBinder =
Expand Down Expand Up @@ -243,6 +246,18 @@ private void completeOnCreate() {
pcGridAdapter = new PcGridAdapter(this, PreferenceConfiguration.readPreferences(this));

initializeViews();

// Start WinCaster remote control service
Intent winCasterServiceIntent = new Intent(this, WinCasterCommandService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(winCasterServiceIntent);
} else {
startService(winCasterServiceIntent);
}

// Start WinCaster mDNS advertiser
winCasterAdvertiser = new WinCasterAdvertiser(this);
winCasterAdvertiser.start();
}

private void startComputerUpdates() {
Expand Down Expand Up @@ -297,6 +312,11 @@ public void onDestroy() {
if (managerBinder != null) {
unbindService(serviceConnection);
}

// Stop WinCaster mDNS advertiser
if (winCasterAdvertiser != null) {
winCasterAdvertiser.stop();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ public ComputerDetails getComputer(String uuid) {
return null;
}

public java.util.List<ComputerDetails> getComputers() {
java.util.List<ComputerDetails> computers = new java.util.ArrayList<>();
synchronized (pollingTuples) {
for (PollingTuple tuple : pollingTuples) {
computers.add(tuple.computer);
}
}
return computers;
}

public void invalidateStateForComputer(String uuid) {
synchronized (pollingTuples) {
for (PollingTuple tuple : pollingTuples) {
Expand Down
Loading