create plugin
14
Build/Android/project.properties
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must be checked in Version Control Systems.
|
||||||
|
#
|
||||||
|
# To customize properties used by the Ant build system edit
|
||||||
|
# "ant.properties", and override values to adapt the script to your
|
||||||
|
# project structure.
|
||||||
|
#
|
||||||
|
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||||
|
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=android-19
|
||||||
BIN
Build/Android/res/drawable-hdpi/icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Build/Android/res/drawable-ldpi/icon.png
Normal file
|
After Width: | Height: | Size: 1011 B |
BIN
Build/Android/res/drawable-mdpi/icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Build/Android/res/drawable-xhdpi/icon.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Build/Android/res/drawable/downloadimageh.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
Build/Android/res/drawable/downloadimagev.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
Build/Android/res/drawable/icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Build/Android/res/drawable/splashscreen_landscape.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
Build/Android/res/drawable/splashscreen_portrait.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
33
Build/Android/src/com/epicgames/unreal/DownloadShim.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package com.epicgames.unreal;
|
||||||
|
|
||||||
|
import com.omixlab.MosisUnreal.OBBDownloaderService;
|
||||||
|
import com.omixlab.MosisUnreal.DownloaderActivity;
|
||||||
|
import android.app.Activity;
|
||||||
|
import com.google.android.vending.expansion.downloader.Helpers;
|
||||||
|
import com.omixlab.MosisUnreal.OBBData;
|
||||||
|
|
||||||
|
|
||||||
|
public class DownloadShim
|
||||||
|
{
|
||||||
|
public static OBBDownloaderService DownloaderService;
|
||||||
|
public static DownloaderActivity DownloadActivity;
|
||||||
|
public static Class<DownloaderActivity> GetDownloaderType() { return DownloaderActivity.class; }
|
||||||
|
public static boolean expansionFilesDelivered(Activity activity, int version) {
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(activity, xf.mIsMain, Integer.toString(version), OBBData.AppType);
|
||||||
|
GameActivity.Log.debug("Checking for file : " + fileName);
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(activity, fileName);
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(activity, fileName);
|
||||||
|
GameActivity.Log.debug("which is really being resolved to : " + fileForNewFile + "\n Or : " + fileForDevFile);
|
||||||
|
if (Helpers.doesFileExist(activity, fileName, xf.mFileSize, false)) {
|
||||||
|
GameActivity.Log.debug("Found OBB here: " + fileForNewFile);
|
||||||
|
}
|
||||||
|
else if (Helpers.doesFileExistDev(activity, fileName, xf.mFileSize, false)) {
|
||||||
|
GameActivity.Log.debug("Found OBB here: " + fileForDevFile);
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
44
Build/Android/src/com/omixlab/MosisUnreal/AlarmReceiver.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source 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.omixlab.MosisUnreal;
|
||||||
|
|
||||||
|
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You should start your derived downloader class when this receiver gets the message
|
||||||
|
* from the alarm service using the provided service helper function within the
|
||||||
|
* DownloaderClientMarshaller. This class must be then registered in your AndroidManifest.xml
|
||||||
|
* file with a section like this:
|
||||||
|
* <receiver android:name=".AlarmReceiver"/>
|
||||||
|
*/
|
||||||
|
public class AlarmReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
try {
|
||||||
|
DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent, OBBDownloaderService.class);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,809 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source 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.omixlab.MosisUnreal;
|
||||||
|
|
||||||
|
import com.android.vending.expansion.zipfile.ZipResourceFile;
|
||||||
|
import com.android.vending.expansion.zipfile.ZipResourceFile.ZipEntryRO;
|
||||||
|
import com.google.android.vending.expansion.downloader.Constants;
|
||||||
|
import com.google.android.vending.expansion.downloader.DownloadProgressInfo;
|
||||||
|
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
|
||||||
|
import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller;
|
||||||
|
import com.google.android.vending.expansion.downloader.Helpers;
|
||||||
|
import com.google.android.vending.expansion.downloader.IDownloaderClient;
|
||||||
|
import com.google.android.vending.expansion.downloader.IDownloaderService;
|
||||||
|
import com.google.android.vending.expansion.downloader.IStub;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Messenger;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.util.zip.CRC32;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.epicgames.unreal.GameActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is sample code for a project built against the downloader library. It
|
||||||
|
* implements the IDownloaderClient that the client marshaler will talk to as
|
||||||
|
* messages are delivered from the DownloaderService.
|
||||||
|
*/
|
||||||
|
public class DownloaderActivity extends Activity implements IDownloaderClient {
|
||||||
|
private static final String LOG_TAG = "LVLDownloader";
|
||||||
|
private ProgressBar mPB;
|
||||||
|
|
||||||
|
private TextView mStatusText;
|
||||||
|
private TextView mProgressFraction;
|
||||||
|
private TextView mProgressPercent;
|
||||||
|
private TextView mAverageSpeed;
|
||||||
|
private TextView mTimeRemaining;
|
||||||
|
|
||||||
|
private View mDashboard;
|
||||||
|
private View mCellMessage;
|
||||||
|
|
||||||
|
private Button mPauseButton;
|
||||||
|
private Button mWiFiSettingsButton;
|
||||||
|
|
||||||
|
private boolean mStatePaused;
|
||||||
|
private int mState;
|
||||||
|
|
||||||
|
private IDownloaderService mRemoteService;
|
||||||
|
|
||||||
|
private IStub mDownloaderClientStub;
|
||||||
|
|
||||||
|
private final CharSequence[] OBBSelectItems = { "Use Store Data", "Use Development Data" };
|
||||||
|
|
||||||
|
|
||||||
|
private void setState(int newState) {
|
||||||
|
if (mState != newState) {
|
||||||
|
mState = newState;
|
||||||
|
mStatusText.setText(Helpers.getDownloaderStringResourceIDFromState(newState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setButtonPausedState(boolean paused) {
|
||||||
|
mStatePaused = paused;
|
||||||
|
int stringResourceID = paused ? R.string.text_button_resume :
|
||||||
|
R.string.text_button_pause;
|
||||||
|
mPauseButton.setText(stringResourceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DownloaderActivity _download;
|
||||||
|
|
||||||
|
private Intent OutputData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go through each of the APK Expansion files defined in the structure above
|
||||||
|
* and determine if the files are present and match the required size. Free
|
||||||
|
* applications should definitely consider doing this, as this allows the
|
||||||
|
* application to be launched for the first time without having a network
|
||||||
|
* connection present. Paid applications that use LVL should probably do at
|
||||||
|
* least one LVL check that requires the network to be present, so this is
|
||||||
|
* not as necessary.
|
||||||
|
*
|
||||||
|
* @return true if they are present.
|
||||||
|
*/
|
||||||
|
boolean expansionFilesDelivered() {
|
||||||
|
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
GameActivity.Log.debug("Checking for file : " + fileName);
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
|
||||||
|
GameActivity.Log.debug("which is really being resolved to : " + fileForNewFile + "\n Or : " + fileForDevFile);
|
||||||
|
if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
|
||||||
|
!Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean onlySingleExpansionFileFound() {
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
GameActivity.Log.debug("Checking for file : " + fileName);
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
|
||||||
|
|
||||||
|
if (Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
|
||||||
|
Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
File getFileDetailsCacheFile() {
|
||||||
|
return new File(this.getExternalFilesDir(null), "cacheFile.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean expansionFilesUptoData() {
|
||||||
|
|
||||||
|
File cacheFile = getFileDetailsCacheFile();
|
||||||
|
// Read data into an array or something...
|
||||||
|
Map<String, Long> fileDetailsMap = new HashMap<String, Long>();
|
||||||
|
|
||||||
|
if(cacheFile.exists()) {
|
||||||
|
try {
|
||||||
|
FileReader fileCache = new FileReader(cacheFile);
|
||||||
|
BufferedReader bufferedFileCache = new BufferedReader(fileCache);
|
||||||
|
List<String> lines = new ArrayList<String>();
|
||||||
|
String line = null;
|
||||||
|
while ((line = bufferedFileCache.readLine()) != null) {
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
bufferedFileCache.close();
|
||||||
|
|
||||||
|
for(String dataLine : lines)
|
||||||
|
{
|
||||||
|
GameActivity.Log.debug("Splitting dataLine => " + dataLine);
|
||||||
|
String[] parts = dataLine.split(",");
|
||||||
|
fileDetailsMap.put(parts[0], Long.parseLong(parts[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
GameActivity.Log.debug("Exception thrown during file details reading.");
|
||||||
|
e.printStackTrace();
|
||||||
|
fileDetailsMap.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
|
||||||
|
// check to see if time/data on files match cached version
|
||||||
|
// if not return false
|
||||||
|
File srcFile = new File(fileForNewFile);
|
||||||
|
File srcDevFile = new File(fileForDevFile);
|
||||||
|
long lastModified = srcFile.lastModified();
|
||||||
|
long lastModifiedDev = srcDevFile.lastModified();
|
||||||
|
if(!(srcFile.exists() && fileDetailsMap.containsKey(fileName) && lastModified == fileDetailsMap.get(fileName))
|
||||||
|
&&
|
||||||
|
!(srcDevFile.exists() && fileDetailsMap.containsKey(fileName) && lastModifiedDev == fileDetailsMap.get(fileName)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private void RemoveOBBFile(int OBBToDelete) {
|
||||||
|
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(DownloaderActivity._download, xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
switch(OBBToDelete)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(DownloaderActivity._download, fileName);
|
||||||
|
File srcFile = new File(fileForNewFile);
|
||||||
|
srcFile.delete();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(DownloaderActivity._download, fileName);
|
||||||
|
File srcDevFile = new File(fileForDevFile);
|
||||||
|
srcDevFile.delete();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessOBBFiles()
|
||||||
|
{
|
||||||
|
if(GameActivity.Get().VerifyOBBOnStartUp && !expansionFilesUptoData()) {
|
||||||
|
validateXAPKZipFiles();
|
||||||
|
} else {
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_FILES_PRESENT);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.noaction, R.anim.noaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculating a moving average for the validation speed so we don't get
|
||||||
|
* jumpy calculations for time etc.
|
||||||
|
*/
|
||||||
|
static private final float SMOOTHING_FACTOR = 0.005f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by the async task
|
||||||
|
*/
|
||||||
|
private boolean mCancelValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go through each of the Expansion APK files and open each as a zip file.
|
||||||
|
* Calculate the CRC for each file and return false if any fail to match.
|
||||||
|
*
|
||||||
|
* @return true if XAPKZipFile is successful
|
||||||
|
*/
|
||||||
|
void validateXAPKZipFiles() {
|
||||||
|
AsyncTask<Object, DownloadProgressInfo, Boolean> validationTask = new AsyncTask<Object, DownloadProgressInfo, Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
mDashboard.setVisibility(View.VISIBLE);
|
||||||
|
mCellMessage.setVisibility(View.GONE);
|
||||||
|
mStatusText.setText(R.string.text_verifying_download);
|
||||||
|
mPauseButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mCancelValidation = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mPauseButton.setVisibility(View.GONE);
|
||||||
|
// mPauseButton.setText(R.string.text_button_cancel_verify);
|
||||||
|
super.onPreExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean doInBackground(Object... params) {
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(
|
||||||
|
DownloaderActivity.this,
|
||||||
|
xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
boolean normalFile = Helpers.doesFileExist(DownloaderActivity.this, fileName, xf.mFileSize, false);
|
||||||
|
boolean devFile = Helpers.doesFileExistDev(DownloaderActivity.this, fileName, xf.mFileSize, false);
|
||||||
|
|
||||||
|
if (!normalFile && !devFile )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(normalFile)
|
||||||
|
{
|
||||||
|
fileName = Helpers.generateSaveFileName(DownloaderActivity.this, fileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileName = Helpers.generateSaveFileNameDevelopment(DownloaderActivity.this, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZipResourceFile zrf;
|
||||||
|
byte[] buf = new byte[1024 * 256];
|
||||||
|
try {
|
||||||
|
zrf = new ZipResourceFile(fileName);
|
||||||
|
ZipEntryRO[] entries = zrf.getAllEntries();
|
||||||
|
/**
|
||||||
|
* First calculate the total compressed length
|
||||||
|
*/
|
||||||
|
long totalCompressedLength = 0;
|
||||||
|
for (ZipEntryRO entry : entries) {
|
||||||
|
totalCompressedLength += entry.mCompressedLength;
|
||||||
|
}
|
||||||
|
float averageVerifySpeed = 0;
|
||||||
|
long totalBytesRemaining = totalCompressedLength;
|
||||||
|
long timeRemaining;
|
||||||
|
/**
|
||||||
|
* Then calculate a CRC for every file in the Zip file,
|
||||||
|
* comparing it to what is stored in the Zip directory.
|
||||||
|
* Note that for compressed Zip files we must extract
|
||||||
|
* the contents to do this comparison.
|
||||||
|
*/
|
||||||
|
for (ZipEntryRO entry : entries) {
|
||||||
|
if (-1 != entry.mCRC32) {
|
||||||
|
long length = entry.mUncompressedLength;
|
||||||
|
CRC32 crc = new CRC32();
|
||||||
|
DataInputStream dis = null;
|
||||||
|
try {
|
||||||
|
dis = new DataInputStream(
|
||||||
|
zrf.getInputStream(entry.mFileName));
|
||||||
|
|
||||||
|
long startTime = SystemClock.uptimeMillis();
|
||||||
|
while (length > 0) {
|
||||||
|
int seek = (int) (length > buf.length ? buf.length
|
||||||
|
: length);
|
||||||
|
dis.readFully(buf, 0, seek);
|
||||||
|
crc.update(buf, 0, seek);
|
||||||
|
length -= seek;
|
||||||
|
long currentTime = SystemClock.uptimeMillis();
|
||||||
|
long timePassed = currentTime - startTime;
|
||||||
|
if (timePassed > 0) {
|
||||||
|
float currentSpeedSample = (float) seek
|
||||||
|
/ (float) timePassed;
|
||||||
|
if (0 != averageVerifySpeed) {
|
||||||
|
averageVerifySpeed = SMOOTHING_FACTOR
|
||||||
|
* currentSpeedSample
|
||||||
|
+ (1 - SMOOTHING_FACTOR)
|
||||||
|
* averageVerifySpeed;
|
||||||
|
} else {
|
||||||
|
averageVerifySpeed = currentSpeedSample;
|
||||||
|
}
|
||||||
|
totalBytesRemaining -= seek;
|
||||||
|
timeRemaining = (long) (totalBytesRemaining / averageVerifySpeed);
|
||||||
|
this.publishProgress(
|
||||||
|
new DownloadProgressInfo(
|
||||||
|
totalCompressedLength,
|
||||||
|
totalCompressedLength
|
||||||
|
- totalBytesRemaining,
|
||||||
|
timeRemaining,
|
||||||
|
averageVerifySpeed)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
startTime = currentTime;
|
||||||
|
if (mCancelValidation)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (crc.getValue() != entry.mCRC32) {
|
||||||
|
Log.e(Constants.TAG,
|
||||||
|
"CRC does not match for entry: "
|
||||||
|
+ entry.mFileName);
|
||||||
|
Log.e(Constants.TAG,
|
||||||
|
"In file: " + entry.getZipFileName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (null != dis) {
|
||||||
|
dis.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onProgressUpdate(DownloadProgressInfo... values) {
|
||||||
|
onDownloadProgress(values[0]);
|
||||||
|
super.onProgressUpdate(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
// save details to cache file...
|
||||||
|
try {
|
||||||
|
File cacheFile = getFileDetailsCacheFile();
|
||||||
|
FileWriter fileCache = new FileWriter(cacheFile);
|
||||||
|
BufferedWriter bufferedFileCache = new BufferedWriter(fileCache);
|
||||||
|
|
||||||
|
|
||||||
|
for (OBBData.XAPKFile xf : OBBData.xAPKS) {
|
||||||
|
String fileName = Helpers.getExpansionAPKFileName(DownloaderActivity.this, xf.mIsMain, xf.mFileVersion, OBBData.AppType);
|
||||||
|
String fileForNewFile = Helpers.generateSaveFileName(DownloaderActivity.this, fileName);
|
||||||
|
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(DownloaderActivity.this, fileName);
|
||||||
|
|
||||||
|
GameActivity.Log.debug("Writing details for file : " + fileName);
|
||||||
|
|
||||||
|
File srcFile = new File(fileForNewFile);
|
||||||
|
File srcDevFile = new File(fileForDevFile);
|
||||||
|
if(srcFile.exists()) {
|
||||||
|
long lastModified = srcFile.lastModified();
|
||||||
|
bufferedFileCache.write(fileName);
|
||||||
|
bufferedFileCache.write(",");
|
||||||
|
bufferedFileCache.write(new Long(lastModified).toString());
|
||||||
|
bufferedFileCache.newLine();
|
||||||
|
GameActivity.Log.debug("Details for file : " + fileName + " with modified time of " + new Long(lastModified).toString() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
long lastModified = srcDevFile.lastModified();
|
||||||
|
bufferedFileCache.write(fileName);
|
||||||
|
bufferedFileCache.write(",");
|
||||||
|
bufferedFileCache.write(new Long(lastModified).toString());
|
||||||
|
bufferedFileCache.newLine();
|
||||||
|
GameActivity.Log.debug("Details for file : " + fileName + " with modified time of " + new Long(lastModified).toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferedFileCache.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
GameActivity.Log.debug("Exception thrown during file details writing.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
mDashboard.setVisibility(View.VISIBLE);
|
||||||
|
mCellMessage.setVisibility(View.GONE);
|
||||||
|
mStatusText.setText(R.string.text_validation_complete);
|
||||||
|
mPauseButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_FILES_PRESENT);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mPauseButton.setText(android.R.string.ok);
|
||||||
|
*/
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_FILES_PRESENT);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// clear cache file if it exists...
|
||||||
|
File cacheFile = getFileDetailsCacheFile();
|
||||||
|
if(cacheFile.exists()) {
|
||||||
|
cacheFile.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
mDashboard.setVisibility(View.VISIBLE);
|
||||||
|
mCellMessage.setVisibility(View.GONE);
|
||||||
|
mStatusText.setText(R.string.text_validation_failed);
|
||||||
|
mPauseButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_INVALID);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mPauseButton.setText(android.R.string.cancel);
|
||||||
|
}
|
||||||
|
super.onPostExecute(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
validationTask.execute(new Object());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the download isn't present, we initialize the download UI. This ties
|
||||||
|
* all of the controls into the remote service calls.
|
||||||
|
*/
|
||||||
|
private void initializeDownloadUI() {
|
||||||
|
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub
|
||||||
|
(this, OBBDownloaderService.class);
|
||||||
|
setContentView(R.layout.downloader_progress);
|
||||||
|
|
||||||
|
mPB = (ProgressBar) findViewById(R.id.progressBar);
|
||||||
|
mStatusText = (TextView) findViewById(R.id.statusText);
|
||||||
|
mProgressFraction = (TextView) findViewById(R.id.progressAsFraction);
|
||||||
|
mProgressPercent = (TextView) findViewById(R.id.progressAsPercentage);
|
||||||
|
mAverageSpeed = (TextView) findViewById(R.id.progressAverageSpeed);
|
||||||
|
mTimeRemaining = (TextView) findViewById(R.id.progressTimeRemaining);
|
||||||
|
mDashboard = findViewById(R.id.downloaderDashboard);
|
||||||
|
mCellMessage = findViewById(R.id.approveCellular);
|
||||||
|
mPauseButton = (Button) findViewById(R.id.pauseButton);
|
||||||
|
mWiFiSettingsButton = (Button) findViewById(R.id.wifiSettingsButton);
|
||||||
|
|
||||||
|
mPauseButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (mStatePaused) {
|
||||||
|
mRemoteService.requestContinueDownload();
|
||||||
|
} else {
|
||||||
|
mRemoteService.requestPauseDownload();
|
||||||
|
}
|
||||||
|
setButtonPausedState(!mStatePaused);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mWiFiSettingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button resumeOnCell = (Button) findViewById(R.id.resumeOverCellular);
|
||||||
|
resumeOnCell.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mRemoteService.setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
|
||||||
|
mRemoteService.requestContinueDownload();
|
||||||
|
mCellMessage.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the activity is first create; we wouldn't create a layout in
|
||||||
|
* the case where we have the file and are moving to another activity
|
||||||
|
* without downloading.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
GameActivity.Log.debug("Starting DownloaderActivity...");
|
||||||
|
_download = this;
|
||||||
|
// Create somewhere to place the output - we'll check this on 'finish' to make sure we are returning 'something'
|
||||||
|
OutputData = new Intent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Both downloading and validation make use of the "download" UI
|
||||||
|
*/
|
||||||
|
initializeDownloadUI();
|
||||||
|
GameActivity.Log.debug("... UI setup. Checking for files.");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before we do anything, are the files we expect already here and
|
||||||
|
* delivered (presumably by Market) For free titles, this is probably
|
||||||
|
* worth doing. (so no Market request is necessary)
|
||||||
|
*/
|
||||||
|
if (!expansionFilesDelivered()) {
|
||||||
|
GameActivity.Log.debug("... Whoops... missing; go go go download system!");
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Make sure we have a key before we try to start the service
|
||||||
|
if(OBBDownloaderService.getPublicKeyLength() == 0) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
|
||||||
|
builder.setCancelable(false)
|
||||||
|
.setTitle("No Google Play Store Key")
|
||||||
|
.setMessage("No OBB found and no store key to try to download. Please set one up in Android Project Settings")
|
||||||
|
.setPositiveButton("Exit", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_NO_PLAY_KEY);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
Intent launchIntent = DownloaderActivity.this
|
||||||
|
.getIntent();
|
||||||
|
Intent intentToLaunchThisActivityFromNotification = new Intent(
|
||||||
|
DownloaderActivity
|
||||||
|
.this, DownloaderActivity.this.getClass());
|
||||||
|
intentToLaunchThisActivityFromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||||
|
Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intentToLaunchThisActivityFromNotification.setAction(launchIntent.getAction());
|
||||||
|
|
||||||
|
if (launchIntent.getCategories() != null) {
|
||||||
|
for (String category : launchIntent.getCategories()) {
|
||||||
|
intentToLaunchThisActivityFromNotification.addCategory(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build PendingIntent used to open this activity from
|
||||||
|
// Notification
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||||
|
DownloaderActivity.this,
|
||||||
|
0, intentToLaunchThisActivityFromNotification,
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
// Request to start the download
|
||||||
|
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
|
||||||
|
pendingIntent, OBBDownloaderService.class);
|
||||||
|
|
||||||
|
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
|
||||||
|
// The DownloaderService has started downloading the files,
|
||||||
|
// show progress
|
||||||
|
initializeDownloadUI();
|
||||||
|
return;
|
||||||
|
} // otherwise, download not needed so we fall through to saying all is OK
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_FILES_PRESENT);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
Log.e(LOG_TAG, "Cannot find own package! MAYDAY!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GameActivity.Log.debug("... Can has! Check 'em Dano!");
|
||||||
|
if(!onlySingleExpansionFileFound()) {
|
||||||
|
// Do some UI here to figure out which we want to keep
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
|
||||||
|
builder.setCancelable(false)
|
||||||
|
.setTitle("Select OBB to use")
|
||||||
|
.setItems(OBBSelectItems, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
|
DownloaderActivity.RemoveOBBFile(item);
|
||||||
|
ProcessOBBFiles();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ProcessOBBFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect the stub to our service on start.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
if (null != mDownloaderClientStub) {
|
||||||
|
mDownloaderClientStub.connect(this);
|
||||||
|
}
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
GameActivity.Log.debug("In onPause");
|
||||||
|
|
||||||
|
if(OutputData.getIntExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_NO_RETURN_CODE) == GameActivity.DOWNLOAD_NO_RETURN_CODE)
|
||||||
|
{
|
||||||
|
GameActivity.Log.debug("onPause returning that user quit the download.");
|
||||||
|
OutputData.putExtra(GameActivity.DOWNLOAD_RETURN_NAME, GameActivity.DOWNLOAD_USER_QUIT);
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect the stub from our service on stop
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (null != mDownloaderClientStub) {
|
||||||
|
mDownloaderClientStub.disconnect(this);
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
setResult(RESULT_OK, OutputData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Critical implementation detail. In onServiceConnected we create the
|
||||||
|
* remote service and marshaler. This is how we pass the client information
|
||||||
|
* back to the service so the client can be properly notified of changes. We
|
||||||
|
* must do this every time we reconnect to the service.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onServiceConnected(Messenger m) {
|
||||||
|
mRemoteService = DownloaderServiceMarshaller.CreateProxy(m);
|
||||||
|
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The download state should trigger changes in the UI --- it may be useful
|
||||||
|
* to show the state as being indeterminate at times. This sample can be
|
||||||
|
* considered a guideline.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDownloadStateChanged(int newState) {
|
||||||
|
setState(newState);
|
||||||
|
boolean showDashboard = true;
|
||||||
|
boolean showCellMessage = false;
|
||||||
|
boolean paused;
|
||||||
|
boolean indeterminate;
|
||||||
|
switch (newState) {
|
||||||
|
case IDownloaderClient.STATE_IDLE:
|
||||||
|
// STATE_IDLE means the service is listening, so it's
|
||||||
|
// safe to start making calls via mRemoteService.
|
||||||
|
paused = false;
|
||||||
|
indeterminate = true;
|
||||||
|
break;
|
||||||
|
case IDownloaderClient.STATE_CONNECTING:
|
||||||
|
case IDownloaderClient.STATE_FETCHING_URL:
|
||||||
|
showDashboard = true;
|
||||||
|
paused = false;
|
||||||
|
indeterminate = true;
|
||||||
|
break;
|
||||||
|
case IDownloaderClient.STATE_DOWNLOADING:
|
||||||
|
paused = false;
|
||||||
|
showDashboard = true;
|
||||||
|
indeterminate = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDownloaderClient.STATE_FAILED_CANCELED:
|
||||||
|
case IDownloaderClient.STATE_FAILED:
|
||||||
|
case IDownloaderClient.STATE_FAILED_FETCHING_URL:
|
||||||
|
case IDownloaderClient.STATE_FAILED_UNLICENSED:
|
||||||
|
paused = true;
|
||||||
|
showDashboard = false;
|
||||||
|
indeterminate = false;
|
||||||
|
break;
|
||||||
|
case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
|
||||||
|
case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
|
||||||
|
showDashboard = false;
|
||||||
|
paused = true;
|
||||||
|
indeterminate = false;
|
||||||
|
showCellMessage = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
|
||||||
|
paused = true;
|
||||||
|
indeterminate = false;
|
||||||
|
break;
|
||||||
|
case IDownloaderClient.STATE_PAUSED_ROAMING:
|
||||||
|
case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
|
||||||
|
paused = true;
|
||||||
|
indeterminate = false;
|
||||||
|
break;
|
||||||
|
case IDownloaderClient.STATE_COMPLETED:
|
||||||
|
showDashboard = false;
|
||||||
|
paused = false;
|
||||||
|
indeterminate = false;
|
||||||
|
validateXAPKZipFiles();
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
paused = true;
|
||||||
|
indeterminate = true;
|
||||||
|
showDashboard = true;
|
||||||
|
}
|
||||||
|
int newDashboardVisibility = showDashboard ? View.VISIBLE : View.GONE;
|
||||||
|
if (mDashboard.getVisibility() != newDashboardVisibility) {
|
||||||
|
mDashboard.setVisibility(newDashboardVisibility);
|
||||||
|
}
|
||||||
|
int cellMessageVisibility = showCellMessage ? View.VISIBLE : View.GONE;
|
||||||
|
if (mCellMessage.getVisibility() != cellMessageVisibility) {
|
||||||
|
mCellMessage.setVisibility(cellMessageVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
mPB.setIndeterminate(indeterminate);
|
||||||
|
setButtonPausedState(paused);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state of the various controls based on the progressinfo object
|
||||||
|
* sent from the downloader service.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onDownloadProgress(DownloadProgressInfo progress) {
|
||||||
|
mAverageSpeed.setText(getString(R.string.kilobytes_per_second,
|
||||||
|
Helpers.getSpeedString(progress.mCurrentSpeed)));
|
||||||
|
mTimeRemaining.setText(getString(R.string.time_remaining,
|
||||||
|
Helpers.getTimeRemaining(progress.mTimeRemaining)));
|
||||||
|
|
||||||
|
progress.mOverallTotal = progress.mOverallTotal;
|
||||||
|
mPB.setMax((int) (progress.mOverallTotal >> 8));
|
||||||
|
mPB.setProgress((int) (progress.mOverallProgress >> 8));
|
||||||
|
mProgressPercent.setText(Long.toString(progress.mOverallProgress
|
||||||
|
* 100 /
|
||||||
|
progress.mOverallTotal) + "%");
|
||||||
|
mProgressFraction.setText(Helpers.getDownloadProgressString
|
||||||
|
(progress.mOverallProgress,
|
||||||
|
progress.mOverallTotal));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
this.mCancelValidation = true;
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
26
Build/Android/src/com/omixlab/MosisUnreal/OBBData.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.omixlab.MosisUnreal;
|
||||||
|
|
||||||
|
public class OBBData
|
||||||
|
{
|
||||||
|
public static final String AppType = "";
|
||||||
|
|
||||||
|
public static class XAPKFile {
|
||||||
|
public final boolean mIsMain;
|
||||||
|
public final String mFileVersion;
|
||||||
|
public final long mFileSize;
|
||||||
|
XAPKFile(boolean isMain, String fileVersion, long fileSize) {
|
||||||
|
mIsMain = isMain;
|
||||||
|
mFileVersion = fileVersion;
|
||||||
|
mFileSize = fileSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final XAPKFile[] xAPKS = {
|
||||||
|
new XAPKFile(
|
||||||
|
true, // true signifies a main file
|
||||||
|
"1", // the version of the APK that the file was uploaded against
|
||||||
|
0L // the length of the file in bytes
|
||||||
|
)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2012 The Android Open Source 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.omixlab.MosisUnreal;
|
||||||
|
|
||||||
|
import com.google.android.vending.expansion.downloader.impl.DownloaderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimal client implementation of the
|
||||||
|
* DownloaderService from the Downloader library.
|
||||||
|
*/
|
||||||
|
public class OBBDownloaderService extends DownloaderService {
|
||||||
|
// stuff for LVL -- MODIFY FOR YOUR APPLICATION!
|
||||||
|
private static final String BASE64_PUBLIC_KEY = "";
|
||||||
|
// used by the preference obfuscater
|
||||||
|
private static final byte[] SALT = new byte[] {
|
||||||
|
1, 43, -12, -1, 54, 98,
|
||||||
|
-100, -12, 43, 2, -8, -4, 9, 5, -106, -108, -33, 45, -1, 84
|
||||||
|
};
|
||||||
|
|
||||||
|
public static int getPublicKeyLength() {
|
||||||
|
return BASE64_PUBLIC_KEY.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This public key comes from your Android Market publisher account, and it
|
||||||
|
* used by the LVL to validate responses from Market on your behalf.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPublicKey() {
|
||||||
|
return BASE64_PUBLIC_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used by the preference obfuscater to make sure that your
|
||||||
|
* obfuscated preferences are different than the ones used by other
|
||||||
|
* applications.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public byte[] getSALT() {
|
||||||
|
return SALT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill this in with the class name for your alarm receiver. We do this
|
||||||
|
* because receivers must be unique across all of Android (it's a good idea
|
||||||
|
* to make sure that your receiver is in your unique package)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAlarmReceiverClassName() {
|
||||||
|
return com.omixlab.MosisUnreal.AlarmReceiver.class.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,9 @@ r.AntiAliasingMethod=3
|
|||||||
bBuildForES31=False
|
bBuildForES31=False
|
||||||
ExtraApplicationSettings=<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2|questpro|quest3" />
|
ExtraApplicationSettings=<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2|questpro|quest3" />
|
||||||
bPackageForMetaQuest=True
|
bPackageForMetaQuest=True
|
||||||
|
PackageName=com.omixlab.[PROJECT]
|
||||||
|
MinSDKVersion=34
|
||||||
|
TargetSDKVersion=36
|
||||||
|
|
||||||
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||||
DefaultGraphicsRHI=DefaultGraphicsRHI_Default
|
DefaultGraphicsRHI=DefaultGraphicsRHI_Default
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"FileVersion": 3,
|
"FileVersion": 3,
|
||||||
"EngineAssociation": "5.4",
|
"EngineAssociation": "5.5",
|
||||||
"Category": "",
|
"Category": "",
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Modules": [
|
"Modules": [
|
||||||
|
|||||||
24
Plugins/MosisSDK/MosisSDK.uplugin
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"FileVersion": 3,
|
||||||
|
"Version": 1,
|
||||||
|
"VersionName": "1.0",
|
||||||
|
"FriendlyName": "MosisSDK",
|
||||||
|
"Description": "",
|
||||||
|
"Category": "Other",
|
||||||
|
"CreatedBy": "OmixLab LTD",
|
||||||
|
"CreatedByURL": "",
|
||||||
|
"DocsURL": "",
|
||||||
|
"MarketplaceURL": "",
|
||||||
|
"SupportURL": "",
|
||||||
|
"CanContainContent": true,
|
||||||
|
"IsBetaVersion": false,
|
||||||
|
"IsExperimentalVersion": false,
|
||||||
|
"Installed": false,
|
||||||
|
"Modules": [
|
||||||
|
{
|
||||||
|
"Name": "MosisSDK",
|
||||||
|
"Type": "Runtime",
|
||||||
|
"LoadingPhase": "Default"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
Plugins/MosisSDK/Resources/Icon128.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
package android.hardware;
|
||||||
|
|
||||||
|
@JavaOnlyStableParcelable @NdkOnlyStableParcelable parcelable HardwareBuffer ndk_header "android/hardware_buffer_aidl.h";
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.omixlab.mosis;
|
||||||
|
|
||||||
|
import android.hardware.HardwareBuffer;
|
||||||
|
|
||||||
|
// oneway = fire-and-forget (asynchronous)
|
||||||
|
oneway interface IMosisListener {
|
||||||
|
void onServiceInitialized(boolean success);
|
||||||
|
void onBufferAvailable(in HardwareBuffer buffer);
|
||||||
|
void onFrameAvailable();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.omixlab.mosis;
|
||||||
|
|
||||||
|
import com.omixlab.mosis.IMosisListener;
|
||||||
|
|
||||||
|
interface IMosisService {
|
||||||
|
boolean initOS(IMosisListener listener);
|
||||||
|
void onTouchDown(float x, float y);
|
||||||
|
void onTouchMove(float x, float y);
|
||||||
|
void onTouchUp(float x, float y);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisListener.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisListener.h"
|
||||||
|
|
||||||
|
#include <android/binder_ibinder.h>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#ifndef __BIONIC__
|
||||||
|
#ifndef __assert2
|
||||||
|
#define __assert2(a,b,c,d) ((void)0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class BnMosisListener : public ::ndk::BnCInterface<IMosisListener> {
|
||||||
|
public:
|
||||||
|
BnMosisListener();
|
||||||
|
virtual ~BnMosisListener();
|
||||||
|
protected:
|
||||||
|
::ndk::SpAIBinder createBinder() override;
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
class IMosisListenerDelegator : public BnMosisListener {
|
||||||
|
public:
|
||||||
|
explicit IMosisListenerDelegator(const std::shared_ptr<IMosisListener> &impl) : _impl(impl) {
|
||||||
|
}
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override {
|
||||||
|
return _impl->onServiceInitialized(in_success);
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override {
|
||||||
|
return _impl->onBufferAvailable(in_buffer);
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus onFrameAvailable() override {
|
||||||
|
return _impl->onFrameAvailable();
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
std::shared_ptr<IMosisListener> _impl;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisService.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisService.h"
|
||||||
|
|
||||||
|
#include <android/binder_ibinder.h>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#ifndef __BIONIC__
|
||||||
|
#ifndef __assert2
|
||||||
|
#define __assert2(a,b,c,d) ((void)0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class BnMosisService : public ::ndk::BnCInterface<IMosisService> {
|
||||||
|
public:
|
||||||
|
BnMosisService();
|
||||||
|
virtual ~BnMosisService();
|
||||||
|
protected:
|
||||||
|
::ndk::SpAIBinder createBinder() override;
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
class IMosisServiceDelegator : public BnMosisService {
|
||||||
|
public:
|
||||||
|
explicit IMosisServiceDelegator(const std::shared_ptr<IMosisService> &impl) : _impl(impl) {
|
||||||
|
}
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override {
|
||||||
|
return _impl->initOS(in_listener, _aidl_return);
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus onTouchDown(float in_x, float in_y) override {
|
||||||
|
return _impl->onTouchDown(in_x, in_y);
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus onTouchMove(float in_x, float in_y) override {
|
||||||
|
return _impl->onTouchMove(in_x, in_y);
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus onTouchUp(float in_x, float in_y) override {
|
||||||
|
return _impl->onTouchUp(in_x, in_y);
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
std::shared_ptr<IMosisService> _impl;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisListener.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisListener.h"
|
||||||
|
|
||||||
|
#include <android/binder_ibinder.h>
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class BpMosisListener : public ::ndk::BpCInterface<IMosisListener> {
|
||||||
|
public:
|
||||||
|
explicit BpMosisListener(const ::ndk::SpAIBinder& binder);
|
||||||
|
virtual ~BpMosisListener();
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override;
|
||||||
|
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override;
|
||||||
|
::ndk::ScopedAStatus onFrameAvailable() override;
|
||||||
|
};
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisService.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisService.h"
|
||||||
|
|
||||||
|
#include <android/binder_ibinder.h>
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class BpMosisService : public ::ndk::BpCInterface<IMosisService> {
|
||||||
|
public:
|
||||||
|
explicit BpMosisService(const ::ndk::SpAIBinder& binder);
|
||||||
|
virtual ~BpMosisService();
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override;
|
||||||
|
::ndk::ScopedAStatus onTouchDown(float in_x, float in_y) override;
|
||||||
|
::ndk::ScopedAStatus onTouchMove(float in_x, float in_y) override;
|
||||||
|
::ndk::ScopedAStatus onTouchUp(float in_x, float in_y) override;
|
||||||
|
};
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisListener.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <android/binder_interface_utils.h>
|
||||||
|
#include <android/hardware_buffer_aidl.h>
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
#include <android/binder_stability.h>
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class IMosisListenerDelegator;
|
||||||
|
|
||||||
|
class IMosisListener : public ::ndk::ICInterface {
|
||||||
|
public:
|
||||||
|
typedef IMosisListenerDelegator DefaultDelegator;
|
||||||
|
static const char* descriptor;
|
||||||
|
IMosisListener();
|
||||||
|
virtual ~IMosisListener();
|
||||||
|
|
||||||
|
static constexpr uint32_t TRANSACTION_onServiceInitialized = FIRST_CALL_TRANSACTION + 0;
|
||||||
|
static constexpr uint32_t TRANSACTION_onBufferAvailable = FIRST_CALL_TRANSACTION + 1;
|
||||||
|
static constexpr uint32_t TRANSACTION_onFrameAvailable = FIRST_CALL_TRANSACTION + 2;
|
||||||
|
|
||||||
|
static std::shared_ptr<IMosisListener> fromBinder(const ::ndk::SpAIBinder& binder);
|
||||||
|
static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisListener>& instance);
|
||||||
|
static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisListener>* instance);
|
||||||
|
static bool setDefaultImpl(const std::shared_ptr<IMosisListener>& impl);
|
||||||
|
static const std::shared_ptr<IMosisListener>& getDefaultImpl();
|
||||||
|
virtual ::ndk::ScopedAStatus onServiceInitialized(bool in_success) = 0;
|
||||||
|
virtual ::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) = 0;
|
||||||
|
virtual ::ndk::ScopedAStatus onFrameAvailable() = 0;
|
||||||
|
private:
|
||||||
|
static std::shared_ptr<IMosisListener> default_impl;
|
||||||
|
};
|
||||||
|
class IMosisListenerDefault : public IMosisListener {
|
||||||
|
public:
|
||||||
|
::ndk::ScopedAStatus onServiceInitialized(bool in_success) override;
|
||||||
|
::ndk::ScopedAStatus onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) override;
|
||||||
|
::ndk::ScopedAStatus onFrameAvailable() override;
|
||||||
|
::ndk::SpAIBinder asBinder() override;
|
||||||
|
bool isRemote() override;
|
||||||
|
};
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisService.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <android/binder_interface_utils.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/IMosisListener.h>
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
#include <android/binder_stability.h>
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
|
||||||
|
namespace aidl::com::omixlab::mosis {
|
||||||
|
class IMosisListener;
|
||||||
|
} // namespace aidl::com::omixlab::mosis
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
class IMosisServiceDelegator;
|
||||||
|
|
||||||
|
class IMosisService : public ::ndk::ICInterface {
|
||||||
|
public:
|
||||||
|
typedef IMosisServiceDelegator DefaultDelegator;
|
||||||
|
static const char* descriptor;
|
||||||
|
IMosisService();
|
||||||
|
virtual ~IMosisService();
|
||||||
|
|
||||||
|
static constexpr uint32_t TRANSACTION_initOS = FIRST_CALL_TRANSACTION + 0;
|
||||||
|
static constexpr uint32_t TRANSACTION_onTouchDown = FIRST_CALL_TRANSACTION + 1;
|
||||||
|
static constexpr uint32_t TRANSACTION_onTouchMove = FIRST_CALL_TRANSACTION + 2;
|
||||||
|
static constexpr uint32_t TRANSACTION_onTouchUp = FIRST_CALL_TRANSACTION + 3;
|
||||||
|
|
||||||
|
static std::shared_ptr<IMosisService> fromBinder(const ::ndk::SpAIBinder& binder);
|
||||||
|
static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisService>& instance);
|
||||||
|
static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisService>* instance);
|
||||||
|
static bool setDefaultImpl(const std::shared_ptr<IMosisService>& impl);
|
||||||
|
static const std::shared_ptr<IMosisService>& getDefaultImpl();
|
||||||
|
virtual ::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) = 0;
|
||||||
|
virtual ::ndk::ScopedAStatus onTouchDown(float in_x, float in_y) = 0;
|
||||||
|
virtual ::ndk::ScopedAStatus onTouchMove(float in_x, float in_y) = 0;
|
||||||
|
virtual ::ndk::ScopedAStatus onTouchUp(float in_x, float in_y) = 0;
|
||||||
|
private:
|
||||||
|
static std::shared_ptr<IMosisService> default_impl;
|
||||||
|
};
|
||||||
|
class IMosisServiceDefault : public IMosisService {
|
||||||
|
public:
|
||||||
|
::ndk::ScopedAStatus initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) override;
|
||||||
|
::ndk::ScopedAStatus onTouchDown(float in_x, float in_y) override;
|
||||||
|
::ndk::ScopedAStatus onTouchMove(float in_x, float in_y) override;
|
||||||
|
::ndk::ScopedAStatus onTouchUp(float in_x, float in_y) override;
|
||||||
|
::ndk::SpAIBinder asBinder() override;
|
||||||
|
bool isRemote() override;
|
||||||
|
};
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisListener.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisListener.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <android/binder_parcel.h>
|
||||||
|
#include <android/binder_parcel_utils.h>
|
||||||
|
#include <android/binder_status.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BnMosisListener.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BpMosisListener.h>
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
static binder_status_t _aidl_com_omixlab_mosis_IMosisListener_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
|
||||||
|
(void)_aidl_in;
|
||||||
|
(void)_aidl_out;
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
|
||||||
|
std::shared_ptr<BnMosisListener> _aidl_impl = std::static_pointer_cast<BnMosisListener>(::ndk::ICInterface::asInterface(_aidl_binder));
|
||||||
|
switch (_aidl_code) {
|
||||||
|
case (FIRST_CALL_TRANSACTION + 0 /*onServiceInitialized*/): {
|
||||||
|
bool in_success;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_success);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onServiceInitialized(in_success);
|
||||||
|
_aidl_ret_status = STATUS_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FIRST_CALL_TRANSACTION + 1 /*onBufferAvailable*/): {
|
||||||
|
::aidl::android::hardware::HardwareBuffer in_buffer;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_buffer);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onBufferAvailable(in_buffer);
|
||||||
|
_aidl_ret_status = STATUS_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FIRST_CALL_TRANSACTION + 2 /*onFrameAvailable*/): {
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onFrameAvailable();
|
||||||
|
_aidl_ret_status = STATUS_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _aidl_ret_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIBinder_Class* _g_aidl_com_omixlab_mosis_IMosisListener_clazz = ::ndk::ICInterface::defineClass(IMosisListener::descriptor, _aidl_com_omixlab_mosis_IMosisListener_onTransact, nullptr, 0);
|
||||||
|
|
||||||
|
BpMosisListener::BpMosisListener(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
|
||||||
|
BpMosisListener::~BpMosisListener() {}
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus BpMosisListener::onServiceInitialized(bool in_success) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_success);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 0 /*onServiceInitialized*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
FLAG_ONEWAY
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisListener::getDefaultImpl()->onServiceInitialized(in_success);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus BpMosisListener::onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& in_buffer) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_buffer);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 1 /*onBufferAvailable*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
FLAG_ONEWAY
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisListener::getDefaultImpl()->onBufferAvailable(in_buffer);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus BpMosisListener::onFrameAvailable() {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 2 /*onFrameAvailable*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
FLAG_ONEWAY
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisListener::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisListener::getDefaultImpl()->onFrameAvailable();
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
// Source for BnMosisListener
|
||||||
|
BnMosisListener::BnMosisListener() {}
|
||||||
|
BnMosisListener::~BnMosisListener() {}
|
||||||
|
::ndk::SpAIBinder BnMosisListener::createBinder() {
|
||||||
|
AIBinder* binder = AIBinder_new(_g_aidl_com_omixlab_mosis_IMosisListener_clazz, static_cast<void*>(this));
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
AIBinder_markCompilationUnitStability(binder);
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
return ::ndk::SpAIBinder(binder);
|
||||||
|
}
|
||||||
|
// Source for IMosisListener
|
||||||
|
const char* IMosisListener::descriptor = "com.omixlab.mosis.IMosisListener";
|
||||||
|
IMosisListener::IMosisListener() {}
|
||||||
|
IMosisListener::~IMosisListener() {}
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<IMosisListener> IMosisListener::fromBinder(const ::ndk::SpAIBinder& binder) {
|
||||||
|
if (!AIBinder_associateClass(binder.get(), _g_aidl_com_omixlab_mosis_IMosisListener_clazz)) {
|
||||||
|
#if __ANDROID_API__ >= 31
|
||||||
|
const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
|
||||||
|
if (originalClass == nullptr) return nullptr;
|
||||||
|
if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
|
||||||
|
return ::ndk::SharedRefBase::make<BpMosisListener>(binder);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
|
||||||
|
if (interface) {
|
||||||
|
return std::static_pointer_cast<IMosisListener>(interface);
|
||||||
|
}
|
||||||
|
return ::ndk::SharedRefBase::make<BpMosisListener>(binder);
|
||||||
|
}
|
||||||
|
|
||||||
|
binder_status_t IMosisListener::writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisListener>& instance) {
|
||||||
|
return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
|
||||||
|
}
|
||||||
|
binder_status_t IMosisListener::readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisListener>* instance) {
|
||||||
|
::ndk::SpAIBinder binder;
|
||||||
|
binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
|
||||||
|
if (status != STATUS_OK) return status;
|
||||||
|
*instance = IMosisListener::fromBinder(binder);
|
||||||
|
return STATUS_OK;
|
||||||
|
}
|
||||||
|
bool IMosisListener::setDefaultImpl(const std::shared_ptr<IMosisListener>& impl) {
|
||||||
|
// Only one user of this interface can use this function
|
||||||
|
// at a time. This is a heuristic to detect if two different
|
||||||
|
// users in the same process use this function.
|
||||||
|
assert(!IMosisListener::default_impl);
|
||||||
|
if (impl) {
|
||||||
|
IMosisListener::default_impl = impl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const std::shared_ptr<IMosisListener>& IMosisListener::getDefaultImpl() {
|
||||||
|
return IMosisListener::default_impl;
|
||||||
|
}
|
||||||
|
std::shared_ptr<IMosisListener> IMosisListener::default_impl = nullptr;
|
||||||
|
::ndk::ScopedAStatus IMosisListenerDefault::onServiceInitialized(bool /*in_success*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus IMosisListenerDefault::onBufferAvailable(const ::aidl::android::hardware::HardwareBuffer& /*in_buffer*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus IMosisListenerDefault::onFrameAvailable() {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::SpAIBinder IMosisListenerDefault::asBinder() {
|
||||||
|
return ::ndk::SpAIBinder();
|
||||||
|
}
|
||||||
|
bool IMosisListenerDefault::isRemote() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,360 @@
|
|||||||
|
/*
|
||||||
|
* This file is auto-generated. DO NOT MODIFY.
|
||||||
|
* Using: C:\\Users\\omara\\AppData\\Local\\Android\\Sdk\\build-tools/36.1.0/aidl.exe --lang=ndk --min_sdk_version=36 -I D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL -o D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated -h D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\Generated D:\\Dev\\Mosis\\MosisUnreal\\Plugins\\MosisSDK\\Source\\MosisSDK\\AIDL\\com/omixlab/mosis\\IMosisService.aidl
|
||||||
|
*
|
||||||
|
* DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
|
||||||
|
* ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
|
||||||
|
* AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
|
||||||
|
*/
|
||||||
|
#include "aidl/com/omixlab/mosis/IMosisService.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <android/binder_parcel.h>
|
||||||
|
#include <android/binder_parcel_utils.h>
|
||||||
|
#include <android/binder_status.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BnMosisListener.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BnMosisService.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BpMosisListener.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/BpMosisService.h>
|
||||||
|
#include <aidl/com/omixlab/mosis/IMosisListener.h>
|
||||||
|
|
||||||
|
namespace aidl {
|
||||||
|
namespace com {
|
||||||
|
namespace omixlab {
|
||||||
|
namespace mosis {
|
||||||
|
static binder_status_t _aidl_com_omixlab_mosis_IMosisService_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
|
||||||
|
(void)_aidl_in;
|
||||||
|
(void)_aidl_out;
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
|
||||||
|
std::shared_ptr<BnMosisService> _aidl_impl = std::static_pointer_cast<BnMosisService>(::ndk::ICInterface::asInterface(_aidl_binder));
|
||||||
|
switch (_aidl_code) {
|
||||||
|
case (FIRST_CALL_TRANSACTION + 0 /*initOS*/): {
|
||||||
|
std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener> in_listener;
|
||||||
|
bool _aidl_return;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_listener);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->initOS(in_listener, &_aidl_return);
|
||||||
|
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) break;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FIRST_CALL_TRANSACTION + 1 /*onTouchDown*/): {
|
||||||
|
float in_x;
|
||||||
|
float in_y;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onTouchDown(in_x, in_y);
|
||||||
|
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) break;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FIRST_CALL_TRANSACTION + 2 /*onTouchMove*/): {
|
||||||
|
float in_x;
|
||||||
|
float in_y;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onTouchMove(in_x, in_y);
|
||||||
|
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) break;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (FIRST_CALL_TRANSACTION + 3 /*onTouchUp*/): {
|
||||||
|
float in_x;
|
||||||
|
float in_y;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus _aidl_status = _aidl_impl->onTouchUp(in_x, in_y);
|
||||||
|
_aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) break;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) break;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _aidl_ret_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AIBinder_Class* _g_aidl_com_omixlab_mosis_IMosisService_clazz = ::ndk::ICInterface::defineClass(IMosisService::descriptor, _aidl_com_omixlab_mosis_IMosisService_onTransact, nullptr, 0);
|
||||||
|
|
||||||
|
BpMosisService::BpMosisService(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
|
||||||
|
BpMosisService::~BpMosisService() {}
|
||||||
|
|
||||||
|
::ndk::ScopedAStatus BpMosisService::initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& in_listener, bool* _aidl_return) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_listener);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 0 /*initOS*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
0
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisService::getDefaultImpl()->initOS(in_listener, _aidl_return);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus BpMosisService::onTouchDown(float in_x, float in_y) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 1 /*onTouchDown*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
0
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisService::getDefaultImpl()->onTouchDown(in_x, in_y);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus BpMosisService::onTouchMove(float in_x, float in_y) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 2 /*onTouchMove*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
0
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisService::getDefaultImpl()->onTouchMove(in_x, in_y);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus BpMosisService::onTouchUp(float in_x, float in_y) {
|
||||||
|
binder_status_t _aidl_ret_status = STATUS_OK;
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
::ndk::ScopedAParcel _aidl_in;
|
||||||
|
::ndk::ScopedAParcel _aidl_out;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_prepareTransaction(asBinderReference().get(), _aidl_in.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_x);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_y);
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AIBinder_transact(
|
||||||
|
asBinderReference().get(),
|
||||||
|
(FIRST_CALL_TRANSACTION + 3 /*onTouchUp*/),
|
||||||
|
_aidl_in.getR(),
|
||||||
|
_aidl_out.getR(),
|
||||||
|
0
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
| static_cast<int>(FLAG_PRIVATE_LOCAL)
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
);
|
||||||
|
if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IMosisService::getDefaultImpl()) {
|
||||||
|
_aidl_status = IMosisService::getDefaultImpl()->onTouchUp(in_x, in_y);
|
||||||
|
goto _aidl_status_return;
|
||||||
|
}
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
_aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
|
||||||
|
if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
|
||||||
|
|
||||||
|
if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
|
||||||
|
_aidl_error:
|
||||||
|
_aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
|
||||||
|
_aidl_status_return:
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
// Source for BnMosisService
|
||||||
|
BnMosisService::BnMosisService() {}
|
||||||
|
BnMosisService::~BnMosisService() {}
|
||||||
|
::ndk::SpAIBinder BnMosisService::createBinder() {
|
||||||
|
AIBinder* binder = AIBinder_new(_g_aidl_com_omixlab_mosis_IMosisService_clazz, static_cast<void*>(this));
|
||||||
|
#ifdef BINDER_STABILITY_SUPPORT
|
||||||
|
AIBinder_markCompilationUnitStability(binder);
|
||||||
|
#endif // BINDER_STABILITY_SUPPORT
|
||||||
|
return ::ndk::SpAIBinder(binder);
|
||||||
|
}
|
||||||
|
// Source for IMosisService
|
||||||
|
const char* IMosisService::descriptor = "com.omixlab.mosis.IMosisService";
|
||||||
|
IMosisService::IMosisService() {}
|
||||||
|
IMosisService::~IMosisService() {}
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<IMosisService> IMosisService::fromBinder(const ::ndk::SpAIBinder& binder) {
|
||||||
|
if (!AIBinder_associateClass(binder.get(), _g_aidl_com_omixlab_mosis_IMosisService_clazz)) {
|
||||||
|
#if __ANDROID_API__ >= 31
|
||||||
|
const AIBinder_Class* originalClass = AIBinder_getClass(binder.get());
|
||||||
|
if (originalClass == nullptr) return nullptr;
|
||||||
|
if (0 == strcmp(AIBinder_Class_getDescriptor(originalClass), descriptor)) {
|
||||||
|
return ::ndk::SharedRefBase::make<BpMosisService>(binder);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
|
||||||
|
if (interface) {
|
||||||
|
return std::static_pointer_cast<IMosisService>(interface);
|
||||||
|
}
|
||||||
|
return ::ndk::SharedRefBase::make<BpMosisService>(binder);
|
||||||
|
}
|
||||||
|
|
||||||
|
binder_status_t IMosisService::writeToParcel(AParcel* parcel, const std::shared_ptr<IMosisService>& instance) {
|
||||||
|
return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
|
||||||
|
}
|
||||||
|
binder_status_t IMosisService::readFromParcel(const AParcel* parcel, std::shared_ptr<IMosisService>* instance) {
|
||||||
|
::ndk::SpAIBinder binder;
|
||||||
|
binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
|
||||||
|
if (status != STATUS_OK) return status;
|
||||||
|
*instance = IMosisService::fromBinder(binder);
|
||||||
|
return STATUS_OK;
|
||||||
|
}
|
||||||
|
bool IMosisService::setDefaultImpl(const std::shared_ptr<IMosisService>& impl) {
|
||||||
|
// Only one user of this interface can use this function
|
||||||
|
// at a time. This is a heuristic to detect if two different
|
||||||
|
// users in the same process use this function.
|
||||||
|
assert(!IMosisService::default_impl);
|
||||||
|
if (impl) {
|
||||||
|
IMosisService::default_impl = impl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const std::shared_ptr<IMosisService>& IMosisService::getDefaultImpl() {
|
||||||
|
return IMosisService::default_impl;
|
||||||
|
}
|
||||||
|
std::shared_ptr<IMosisService> IMosisService::default_impl = nullptr;
|
||||||
|
::ndk::ScopedAStatus IMosisServiceDefault::initOS(const std::shared_ptr<::aidl::com::omixlab::mosis::IMosisListener>& /*in_listener*/, bool* /*_aidl_return*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus IMosisServiceDefault::onTouchDown(float /*in_x*/, float /*in_y*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus IMosisServiceDefault::onTouchMove(float /*in_x*/, float /*in_y*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::ScopedAStatus IMosisServiceDefault::onTouchUp(float /*in_x*/, float /*in_y*/) {
|
||||||
|
::ndk::ScopedAStatus _aidl_status;
|
||||||
|
_aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
|
||||||
|
return _aidl_status;
|
||||||
|
}
|
||||||
|
::ndk::SpAIBinder IMosisServiceDefault::asBinder() {
|
||||||
|
return ::ndk::SpAIBinder();
|
||||||
|
}
|
||||||
|
bool IMosisServiceDefault::isRemote() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // namespace mosis
|
||||||
|
} // namespace omixlab
|
||||||
|
} // namespace com
|
||||||
|
} // namespace aidl
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.omixlab.mosis
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Context.BIND_AUTO_CREATE
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.ServiceConnection
|
||||||
|
import android.os.IBinder
|
||||||
|
import androidx.core.content.ContextCompat.startForegroundService
|
||||||
|
import com.omixlab.mosis.IMosisService
|
||||||
|
import com.epicgames.unreal.GameActivity
|
||||||
|
|
||||||
|
class MyKotlinPlugin {
|
||||||
|
companion object {
|
||||||
|
val instance: MyKotlinPlugin by lazy { MyKotlinPlugin() }
|
||||||
|
@JvmStatic
|
||||||
|
fun StartMosisService() {
|
||||||
|
instance.startRemoteService()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var remote_service: IMosisService? = null
|
||||||
|
val connection = object : ServiceConnection {
|
||||||
|
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
||||||
|
Log.d("MosisTest", "Service Connected")
|
||||||
|
remote_service = IMosisService.Stub.asInterface(service)
|
||||||
|
serviceConnected(service)
|
||||||
|
}
|
||||||
|
override fun onServiceDisconnected(arg0: ComponentName) {
|
||||||
|
Log.d("MosisTest", "Service Disconnected")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun startRemoteService() {
|
||||||
|
val intent = Intent("com.omixlab.mosis.SERVICE")
|
||||||
|
intent.setPackage("com.omixlab.mosis")
|
||||||
|
val currentActivity = GameActivity.Get()
|
||||||
|
try {
|
||||||
|
startForegroundService(currentActivity, intent)
|
||||||
|
val result = currentActivity.bindService(intent, connection, BIND_AUTO_CREATE)
|
||||||
|
Log.d("MosisTest", "Bind result: $result")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("MosisTest", "Bind failed", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
external fun serviceConnected(binder: IBinder)
|
||||||
|
}
|
||||||
70
Plugins/MosisSDK/Source/MosisSDK/MosisSDK.Build.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using UnrealBuildTool;
|
||||||
|
|
||||||
|
public class MosisSDK : ModuleRules
|
||||||
|
{
|
||||||
|
public MosisSDK(ReadOnlyTargetRules Target) : base(Target)
|
||||||
|
{
|
||||||
|
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
|
PrivateDependencyModuleNames.AddRange(
|
||||||
|
new string[]
|
||||||
|
{
|
||||||
|
"CoreUObject",
|
||||||
|
"Engine",
|
||||||
|
"Slate",
|
||||||
|
"SlateCore",
|
||||||
|
"Launch"
|
||||||
|
// ... add private dependencies that you statically link with here ...
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
||||||
|
{
|
||||||
|
// Register the UPL file
|
||||||
|
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
|
||||||
|
AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "MosisSDK_UPL.xml"));
|
||||||
|
PublicAdditionalLibraries.Add("binder_ndk");
|
||||||
|
|
||||||
|
string SDKPath = Environment.GetEnvironmentVariable("ANDROID_HOME");
|
||||||
|
string BinderPath = Path.Combine(SDKPath, "platforms/android-36/optional/libbinder_ndk_cpp");
|
||||||
|
PublicIncludePaths.Add(BinderPath);
|
||||||
|
|
||||||
|
string AidlPath = Path.Combine(SDKPath, "build-tools/36.1.0/aidl.exe");
|
||||||
|
string AidlSourceDir = Path.Combine(ModuleDirectory, "AIDL");
|
||||||
|
string OutputHeaderDir = Path.Combine(ModuleDirectory, "Generated");
|
||||||
|
string OutputCppDir = OutputHeaderDir;
|
||||||
|
|
||||||
|
string[] Files = Directory.GetFiles(Path.Combine(AidlSourceDir, "com/omixlab/mosis"), "*.aidl", SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
foreach (string FilePath in Files)
|
||||||
|
{
|
||||||
|
string Args = $"--lang=ndk --min_sdk_version=36 -I \"{AidlSourceDir}\" -o \"{OutputCppDir}\" -h \"{OutputHeaderDir}\" \"{FilePath}\"";
|
||||||
|
ProcessStartInfo PSI = new ProcessStartInfo();
|
||||||
|
PSI.FileName = AidlPath;
|
||||||
|
PSI.Arguments = Args;
|
||||||
|
PSI.RedirectStandardOutput = true;
|
||||||
|
PSI.RedirectStandardError = true;
|
||||||
|
PSI.UseShellExecute = false;
|
||||||
|
PSI.CreateNoWindow = true;
|
||||||
|
|
||||||
|
Console.WriteLine($"Running AIDL : {Args}");
|
||||||
|
|
||||||
|
using (Process Proc = Process.Start(PSI))
|
||||||
|
{
|
||||||
|
Proc.WaitForExit();
|
||||||
|
if (Proc.ExitCode != 0)
|
||||||
|
{
|
||||||
|
string Error = Proc.StandardError.ReadToEnd();
|
||||||
|
Console.WriteLine($"AIDL Error: {Error}");
|
||||||
|
throw new BuildException($"Failed to compile AIDL: {FilePath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Plugins/MosisSDK/Source/MosisSDK/MosisSDK_UPL.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<androidManifestUpdates>
|
||||||
|
<addElements tag="manifest">
|
||||||
|
<queries>
|
||||||
|
<package android:name="com.omixlab.mosis" />
|
||||||
|
</queries>
|
||||||
|
</addElements>
|
||||||
|
</androidManifestUpdates>
|
||||||
|
<proguardAdditions>
|
||||||
|
<insert>
|
||||||
|
-keep class com.omixlab.mosis.MyKotlinPlugin { *; }
|
||||||
|
-keep interface com.omixlab.mosis.IMosisListener { *; }
|
||||||
|
-keep interface com.omixlab.mosis.IMosisService { *; }
|
||||||
|
</insert>
|
||||||
|
</proguardAdditions>
|
||||||
|
<buildscriptGradleAdditions>
|
||||||
|
<insert>
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0"
|
||||||
|
}
|
||||||
|
</insert>
|
||||||
|
</buildscriptGradleAdditions>
|
||||||
|
<buildGradleAdditions>
|
||||||
|
<insert>
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
android {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
aidl = true
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
kotlin.srcDirs += ['src/main/kotlin']
|
||||||
|
java.srcDirs += ['src/main/aidl_gen']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.3.0'
|
||||||
|
}
|
||||||
|
</insert>
|
||||||
|
</buildGradleAdditions>
|
||||||
|
<resourceCopies>
|
||||||
|
<copyDir src="$S(PluginDir)/Java" dst="$S(BuildDir)/gradle/app/src/main/kotlin" />
|
||||||
|
<copyDir src="$S(PluginDir)/../../../../../MosisService/build/generated/aidl_source_output_dir/debug/out" dst="$S(BuildDir)/gradle/app/src/main/aidl_gen" />
|
||||||
|
</resourceCopies>
|
||||||
|
</root>
|
||||||
46
Plugins/MosisSDK/Source/MosisSDK/Private/MosisSDK.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "MosisSDK.h"
|
||||||
|
|
||||||
|
#if PLATFORM_ANDROID
|
||||||
|
|
||||||
|
#include "Android/AndroidApplication.h"
|
||||||
|
#include "Android/AndroidJNI.h"
|
||||||
|
#include "Android/AndroidJava.h"
|
||||||
|
#include <android/binder_ibinder_jni.h>
|
||||||
|
|
||||||
|
void FMosisSDKModule::StartupModule()
|
||||||
|
{
|
||||||
|
if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
|
||||||
|
{
|
||||||
|
jclass ManagerClass = FAndroidApplication::FindJavaClass("com/omixlab/mosis/MyKotlinPlugin");
|
||||||
|
if (ManagerClass)
|
||||||
|
{
|
||||||
|
jmethodID BindMethod = Env->GetStaticMethodID(ManagerClass, "StartMosisService", "()V");
|
||||||
|
Env->CallStaticVoidMethod(ManagerClass, BindMethod);
|
||||||
|
UE_LOG(LogTemp, Log, TEXT("Requested Bind to Android Service..."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FMosisSDKModule::ShutdownModule()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_omixlab_mosis_MyKotlinPlugin_serviceConnected(JNIEnv* env, jobject thiz,
|
||||||
|
jobject binder)
|
||||||
|
{
|
||||||
|
AIBinder* pBinder = AIBinder_fromJavaBinder(env, binder);
|
||||||
|
//const ndk::SpAIBinder spBinder(pBinder);
|
||||||
|
//g_service = IMosisService::fromBinder(spBinder);
|
||||||
|
//Logger::Log("Service Connected");
|
||||||
|
//g_context = ndk::SharedRefBase::make<ServiceContext>();
|
||||||
|
//bool result{};
|
||||||
|
//g_service->initOS(g_context, &result);
|
||||||
|
//Logger::Log(std::format("InitOS returned {}", result));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
IMPLEMENT_MODULE(FMosisSDKModule, MosisSDK)
|
||||||
15
Plugins/MosisSDK/Source/MosisSDK/Public/MosisSDK.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Modules/ModuleManager.h"
|
||||||
|
|
||||||
|
class FMosisSDKModule : public IModuleInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** IModuleInterface implementation */
|
||||||
|
virtual void StartupModule() override;
|
||||||
|
virtual void ShutdownModule() override;
|
||||||
|
};
|
||||||