Skip to content

Commit 34268e4

Browse files
committed
Revert "Bump to SDL2 2.0.10 & extract .java from SDL2 tarball: merge conflicts fixed (kivy#2113)"
This reverts commit 1b887be.
1 parent 8d360d3 commit 34268e4

File tree

21 files changed

+5209
-127
lines changed

21 files changed

+5209
-127
lines changed

pythonforandroid/bootstrap.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,6 @@ def get_bootstrap_dirs(self):
152152
]
153153
return bootstrap_dirs
154154

155-
def _copy_in_final_files(self):
156-
if self.name == "sdl2":
157-
# Get the paths for copying SDL2's java source code:
158-
sdl2_recipe = Recipe.get_recipe("sdl2", self.ctx)
159-
sdl2_build_dir = sdl2_recipe.get_jni_dir()
160-
src_dir = join(sdl2_build_dir, "SDL", "android-project",
161-
"app", "src", "main", "java",
162-
"org", "libsdl", "app")
163-
target_dir = join(self.dist_dir, 'src', 'main', 'java', 'org',
164-
'libsdl', 'app')
165-
166-
# Do actual copying:
167-
info('Copying in SDL2 .java files from: ' + str(src_dir))
168-
if not os.path.exists(target_dir):
169-
os.makedirs(target_dir)
170-
copy_files(src_dir, target_dir, override=True)
171-
172155
def prepare_build_dir(self):
173156
"""Ensure that a build dir exists for the recipe. This same single
174157
dir will be used for building all different archs."""
@@ -185,12 +168,7 @@ def prepare_build_dir(self):
185168
def prepare_dist_dir(self):
186169
ensure_dir(self.dist_dir)
187170

188-
def assemble_distribution(self):
189-
''' Copies all the files into the distribution (this function is
190-
overridden by the specific bootstrap classes to do this)
191-
and add in the distribution info.
192-
'''
193-
self._copy_in_final_files()
171+
def run_distribute(self):
194172
self.distribution.save_info(self.dist_dir)
195173

196174
@classmethod

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -530,28 +530,24 @@ def make_package(args):
530530
for patch_name in os.listdir(join('src', 'patches')):
531531
patch_path = join('src', 'patches', patch_name)
532532
print("Applying patch: " + str(patch_path))
533-
534-
# -N: insist this is FORWARD patch, don't reverse apply
535-
# -p1: strip first path component
536-
# -t: batch mode, don't ask questions
537-
patch_command = ["patch", "-N", "-p1", "-t", "-i", patch_path]
538-
539533
try:
540-
# Use a dry run to establish whether the patch is already applied.
541-
# If we don't check this, the patch may be partially applied (which is bad!)
542-
subprocess.check_output(patch_command + ["--dry-run"])
534+
subprocess.check_output([
535+
# -N: insist this is FORWARd patch, don't reverse apply
536+
# -p1: strip first path component
537+
# -t: batch mode, don't ask questions
538+
"patch", "-N", "-p1", "-t", "-i", patch_path
539+
])
543540
except subprocess.CalledProcessError as e:
544541
if e.returncode == 1:
545-
# Return code 1 means not all hunks could be applied, this usually
546-
# means the patch is already applied.
547-
print("Warning: failed to apply patch (exit code 1), "
548-
"assuming it is already applied: ",
549-
str(patch_path))
542+
# Return code 1 means it didn't apply, this will
543+
# usually mean it is already applied.
544+
print("Warning: failed to apply patch (" +
545+
"exit code 1), " +
546+
"assuming it is already applied: " +
547+
str(patch_path)
548+
)
550549
else:
551550
raise e
552-
else:
553-
# The dry run worked, so do the real thing
554-
subprocess.check_output(patch_command)
555551

556552

557553
def parse_args_and_make_package(args=None):

pythonforandroid/bootstraps/empty/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class EmptyBootstrap(Bootstrap):
88

99
can_be_chosen_automatically = False
1010

11-
def assemble_distribution(self):
11+
def run_distribute(self):
1212
print('empty bootstrap has no distribute')
1313
exit(1)
1414

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SDL2GradleBootstrap(Bootstrap):
1212
set(Bootstrap.recipe_depends).union({'sdl2'})
1313
)
1414

15-
def assemble_distribution(self):
15+
def run_distribute(self):
1616
info_main("# Creating Android project ({})".format(self.name))
1717

1818
arch = self.ctx.archs[0]
@@ -50,7 +50,7 @@ def assemble_distribution(self):
5050
if not self.ctx.build_as_debuggable:
5151
self.strip_libraries(arch)
5252
self.fry_eggs(site_packages_dir)
53-
super().assemble_distribution()
53+
super().run_distribute()
5454

5555

5656
bootstrap = SDL2GradleBootstrap()

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ protected void onPostExecute(String result) {
193193
mActivity.getPackageName(), PackageManager.GET_META_DATA).metaData;
194194

195195
PowerManager pm = (PowerManager) mActivity.getSystemService(Context.POWER_SERVICE);
196-
if (mActivity.mMetaData.getInt("wakelock") == 1) {
196+
if ( mActivity.mMetaData.getInt("wakelock") == 1 ) {
197197
mActivity.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "Screen On");
198198
mActivity.mWakeLock.acquire();
199199
}
@@ -450,32 +450,35 @@ public void appConfirmedActive() {
450450
public void considerLoadingScreenRemoval() {
451451
if (loadingScreenRemovalTimer != null)
452452
return;
453-
if (PythonActivity.mSingleton != null &&
454-
mAppConfirmedActive &&
455-
loadingScreenRemovalTimer == null) {
456-
Log.v(TAG, "loading screen timer Runnable() launched.");
457-
// Remove loading screen but with a delay.
458-
// (app can use p4a's android.loadingscreen module to
459-
// do it quicker if it wants to)
460-
TimerTask removalTask = new TimerTask() {
461-
@Override
462-
public void run() {
463-
// post a runnable to the handler
464-
runOnUiThread(new Runnable() {
453+
runOnUiThread(new Runnable() {
454+
public void run() {
455+
if (((PythonActivity)PythonActivity.mSingleton).mAppConfirmedActive &&
456+
loadingScreenRemovalTimer == null) {
457+
// Remove loading screen but with a delay.
458+
// (app can use p4a's android.loadingscreen module to
459+
// do it quicker if it wants to)
460+
// get a handler (call from main thread)
461+
// this will run when timer elapses
462+
TimerTask removalTask = new TimerTask() {
465463
@Override
466464
public void run() {
467-
Log.v(TAG, "loading screen timer Runnable() finished.");
468-
PythonActivity activity =
469-
((PythonActivity)PythonActivity.mSingleton);
470-
if (activity != null)
471-
activity.removeLoadingScreen();
465+
// post a runnable to the handler
466+
runOnUiThread(new Runnable() {
467+
@Override
468+
public void run() {
469+
PythonActivity activity =
470+
((PythonActivity)PythonActivity.mSingleton);
471+
if (activity != null)
472+
activity.removeLoadingScreen();
473+
}
474+
});
472475
}
473-
});
476+
};
477+
loadingScreenRemovalTimer = new Timer();
478+
loadingScreenRemovalTimer.schedule(removalTask, 5000);
474479
}
475-
};
476-
loadingScreenRemovalTimer = new Timer();
477-
loadingScreenRemovalTimer.schedule(removalTask, 5000);
478-
}
480+
}
481+
});
479482
}
480483

481484
public void removeLoadingScreen() {
@@ -586,30 +589,14 @@ protected void onResume() {
586589
if (this.mWakeLock != null) {
587590
this.mWakeLock.acquire();
588591
}
589-
Log.v(TAG, "onResume(), mSDLThread exists yet: " + (mSDLThread != null));
592+
Log.v(TAG, "onResume()");
590593
try {
591594
super.onResume();
592-
if (mSDLThread == null && !mIsResumedCalled) {
593-
// Ok so SDL2's onStart() usually launches the native code.
594-
// However, this may fail if native libs aren't loaded yet at that point
595-
// (due ot our loading screen) so we may need to manually trigger this,
596-
// otherwise code would only launch by leaving & re-entering the app:
597-
Log.v(TAG, "Loading screen workaround: triggering native resume");
598-
if (mSDLThread == null && mCurrentNativeState == NativeState.RESUMED) {
599-
// Force a state change so SDL2 doesn't just ignore the resume:
600-
mCurrentNativeState = NativeState.PAUSED;
601-
}
602-
resumeNativeThread(); // native resume to call native code
603-
}
604595
} catch (UnsatisfiedLinkError e) {
605596
// Catch resume while still in loading screen failing to
606597
// call native function (since it's not yet loaded)
607-
Log.v(TAG, "failed to call native onResume() because libs " +
608-
"aren't loaded yet. this is expected to happen");
609598
}
610599
considerLoadingScreenRemoval();
611-
Log.v(TAG, "onResume() done in PythonActivity, " +
612-
"mSDLThread exists yet: " + (mSDLThread != null));
613600
}
614601

615602
@Override
@@ -619,7 +606,6 @@ public void onWindowFocusChanged(boolean hasFocus) {
619606
} catch (UnsatisfiedLinkError e) {
620607
// Catch window focus while still in loading screen failing to
621608
// call native function (since it's not yet loaded)
622-
return; // no point in barging further
623609
}
624610
considerLoadingScreenRemoval();
625611
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.libsdl.app;
2+
3+
interface HIDDevice
4+
{
5+
public int getId();
6+
public int getVendorId();
7+
public int getProductId();
8+
public String getSerialNumber();
9+
public int getVersion();
10+
public String getManufacturerName();
11+
public String getProductName();
12+
public boolean open();
13+
public int sendFeatureReport(byte[] report);
14+
public int sendOutputReport(byte[] report);
15+
public boolean getFeatureReport(byte[] report);
16+
public void setFrozen(boolean frozen);
17+
public void close();
18+
public void shutdown();
19+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy