Merge branch 'v0.20.x'

This commit is contained in:
Max Kellermann 2018-08-20 11:27:56 +02:00
commit 0b7d7fe069
5 changed files with 49 additions and 84 deletions

View File

@ -345,6 +345,7 @@ clean-local:
rm -rf android/build rm -rf android/build
libmpd.so: $(filter %.a,$(src_mpd_LDADD)) libmain.a libmpd.so: $(filter %.a,$(src_mpd_LDADD)) libmain.a
$(AM_V_GEN)
$(AM_V_CXXLD)$(CXXLD) -shared -Wl,--no-undefined,-shared,-Bsymbolic -llog -lz -o $@ $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) src/libmain_a-Main.o $(src_mpd_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLD) -shared -Wl,--no-undefined,-shared,-Bsymbolic -llog -lz -o $@ $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) src/libmain_a-Main.o $(src_mpd_LDADD) $(LIBS)
ANDROID_SDK_BUILD_TOOLS_VERSION = 27.0.0 ANDROID_SDK_BUILD_TOOLS_VERSION = 27.0.0
@ -373,17 +374,19 @@ AIDL_JAVA_FILES = $(patsubst $(srcdir)/android/src/%.aidl,android/build/src/org/
android/build/src/org/musicpd/IMain.java: android/build/src/org/musicpd/IMainCallback.java android/build/src/org/musicpd/IMain.java: android/build/src/org/musicpd/IMainCallback.java
$(AIDL_JAVA_FILES): android/build/src/org/musicpd/%.java: $(srcdir)/android/src/%.aidl $(AIDL_JAVA_FILES): android/build/src/org/musicpd/%.java: $(srcdir)/android/src/%.aidl
@$(MKDIR_P) $(@D) $(AM_V_GEN)
@cp $< $(@D)/ $(AM_V_at)$(MKDIR_P) $(@D)
$(AIDL) -Iandroid/build/src -oandroid/build/src $(patsubst %.java,%.aidl,$@) $(AM_V_at)cp $< $(@D)/
$(AM_V_at)$(AIDL) -Iandroid/build/src -oandroid/build/src $(patsubst %.java,%.aidl,$@)
$(ANDROID_XML_RES_COPIES): $(ANDROID_XML_RES) $(ANDROID_XML_RES_COPIES): $(ANDROID_XML_RES)
@$(MKDIR_P) $(dir $@) $(AM_V_at)$(MKDIR_P) $(@D)
cp $(patsubst android/build/%,$(srcdir)/android/%,$@) $@ $(AM_V_at)cp $(patsubst android/build/%,$(srcdir)/android/%,$@) $@
android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawable/icon.png android/build/res/drawable/notification_icon.png android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawable/icon.png android/build/res/drawable/notification_icon.png
@$(MKDIR_P) android/build/gen $(AM_V_GEN)
$(AAPT) package -f -m --auto-add-overlay \ $(AM_V_at)$(MKDIR_P) android/build/gen
$(AM_V_at)$(AAPT) package -f -m --auto-add-overlay \
--custom-package org.musicpd \ --custom-package org.musicpd \
-M $(srcdir)/android/AndroidManifest.xml \ -M $(srcdir)/android/AndroidManifest.xml \
-S android/build/res \ -S android/build/res \
@ -395,42 +398,50 @@ android/build/resources.apk: $(ANDROID_XML_RES_COPIES) android/build/res/drawabl
android/build/gen/org/musicpd/R.java: android/build/resources.apk android/build/gen/org/musicpd/R.java: android/build/resources.apk
android/build/classes.dex: $(JAVA_SOURCE_PATHS) $(AIDL_JAVA_FILES) android/build/gen/org/musicpd/R.java android/build/classes.dex: $(JAVA_SOURCE_PATHS) $(AIDL_JAVA_FILES) android/build/gen/org/musicpd/R.java
@$(MKDIR_P) $(JAVA_CLASSFILES_DIR) $(AM_V_GEN)
$(JAVAC) -source 1.6 -target 1.6 -Xlint:-options \ $(AM_V_at)$(MKDIR_P) $(JAVA_CLASSFILES_DIR)
$(AM_V_at)$(JAVAC) -source 1.6 -target 1.6 -Xlint:-options \
-cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \ -cp $(ANDROID_SDK_PLATFORM_DIR)/android.jar:$(JAVA_CLASSFILES_DIR) \
-h android/build/include \ -h android/build/include \
-d $(JAVA_CLASSFILES_DIR) $^ -d $(JAVA_CLASSFILES_DIR) $^
$(DX) --dex --output $@ $(JAVA_CLASSFILES_DIR) $(AM_V_at)$(DX) --dex --output $@ $(JAVA_CLASSFILES_DIR)
android/build/include/org_musicpd_Bridge.h: android/build/classes.dex android/build/include/org_musicpd_Bridge.h: android/build/classes.dex
BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h BUILT_SOURCES = android/build/include/org_musicpd_Bridge.h
android/build/lib/$(ANDROID_ABI)/libmpd.so: libmpd.so android/build/lib/$(ANDROID_ABI)/libmpd.so: libmpd.so
mkdir -p $(@D) $(AM_V_GEN)
rm -f $@ $(AM_V_at)$(MKDIR_P) $(@D)
$(STRIP) -o $@ $< $(AM_V_at)rm -f $@
$(AM_V_at)$(STRIP) -o $@ $<
android/build/res/drawable/icon.png: mpd.svg android/build/res/drawable/icon.png: mpd.svg
mkdir -p $(@D) $(AM_V_GEN)
rsvg-convert --width=48 --height=48 $< -o $@ $(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_at)rsvg-convert --width=48 --height=48 $< -o $@
android/build/res/drawable/notification_icon.png: android/build/res/drawable/icon.png android/build/res/drawable/notification_icon.png: android/build/res/drawable/icon.png
convert $< -colorspace Gray -gamma 2.2 $@ $(AM_V_GEN)
$(AM_V_at)convert $< -colorspace Gray -gamma 2.2 $@
.DELETE_ON_ERROR: android/build/unsigned.apk .DELETE_ON_ERROR: android/build/unsigned.apk
android/build/unsigned.apk: android/build/classes.dex android/build/resources.apk android/build/lib/$(ANDROID_ABI)/libmpd.so android/build/unsigned.apk: android/build/classes.dex android/build/resources.apk android/build/lib/$(ANDROID_ABI)/libmpd.so
cp android/build/resources.apk $@ $(AM_V_GEN)
cd $(dir $@) && zip -q -r $(notdir $@) classes.dex lib $(AM_V_at)cp android/build/resources.apk $@
$(AM_V_at)cd $(@D) && zip -q -r $(@F) classes.dex lib
android/build/$(APK_NAME)-debug.apk: android/build/unsigned.apk android/build/$(APK_NAME)-debug.apk: android/build/unsigned.apk
jarsigner -keystore $(HOME)/.android/debug.keystore -storepass android -signedjar $@ $< androiddebugkey $(AM_V_GEN)
$(AM_V_at)jarsigner -keystore $(HOME)/.android/debug.keystore -storepass android -signedjar $@ $< androiddebugkey
android/build/$(APK_NAME)-release-unaligned.apk: android/build/unsigned.apk android/build/$(APK_NAME)-release-unaligned.apk: android/build/unsigned.apk
jarsigner -digestalg SHA1 -sigalg MD5withRSA -storepass:env ANDROID_KEYSTORE_PASS -keystore $(ANDROID_KEYSTORE) -signedjar $@ $< $(ANDROID_KEY_ALIAS) $(AM_V_GEN)
$(AM_V_at)jarsigner -digestalg SHA1 -sigalg MD5withRSA -storepass:env ANDROID_KEYSTORE_PASS -keystore $(ANDROID_KEYSTORE) -signedjar $@ $< $(ANDROID_KEY_ALIAS)
android/build/$(APK_NAME).apk: android/build/$(APK_NAME)-release-unaligned.apk android/build/$(APK_NAME).apk: android/build/$(APK_NAME)-release-unaligned.apk
$(ZIPALIGN) -f 4 $< $@ $(AM_V_GEN)
$(AM_V_at)$(ZIPALIGN) -f 4 $< $@
endif endif

View File

@ -156,38 +156,6 @@ public class Main extends Service implements Runnable {
sendMessage(MSG_SEND_STATUS, mStatus, 0, mError); sendMessage(MSG_SEND_STATUS, mStatus, 0, mError);
} }
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private Notification buildNotificationGB(int title, int text, int icon, PendingIntent contentIntent) {
final Notification notification = new Notification();
notification.icon = R.drawable.icon;
notification.contentView = new RemoteViews(getPackageName(), R.layout.custom_notification_gb);
notification.contentView.setImageViewResource(R.id.image, icon);
notification.contentView.setTextViewText(R.id.title, getText(title));
notification.contentView.setTextViewText(R.id.text, getText(text));
notification.contentIntent = contentIntent;
return notification;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private Notification buildNotificationHC(int title, int text, int icon, PendingIntent contentIntent) {
return new Notification.Builder(this)
.setContentTitle(getText(title))
.setContentText(getText(text))
.setSmallIcon(icon)
.setContentIntent(contentIntent)
.getNotification();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private Notification buildNotificationJB(int title, int text, int icon, PendingIntent contentIntent) {
return new Notification.Builder(this)
.setContentTitle(getText(title))
.setContentText(getText(text))
.setSmallIcon(icon)
.setContentIntent(contentIntent)
.build();
}
private void start() { private void start() {
if (mThread != null) if (mThread != null)
return; return;
@ -200,26 +168,12 @@ public class Main extends Service implements Runnable {
final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, final PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
mainIntent, PendingIntent.FLAG_CANCEL_CURRENT); mainIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Notification notification; Notification notification = new Notification.Builder(this)
.setContentTitle(getText(R.string.notification_title_mpd_running))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) .setContentText(getText(R.string.notification_text_mpd_running))
notification = buildNotificationJB( .setSmallIcon(R.drawable.notification_icon)
R.string.notification_title_mpd_running, .setContentIntent(contentIntent)
R.string.notification_text_mpd_running, .build();
R.drawable.notification_icon,
contentIntent);
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
notification = buildNotificationHC(
R.string.notification_title_mpd_running,
R.string.notification_text_mpd_running,
R.drawable.notification_icon,
contentIntent);
else
notification = buildNotificationGB(
R.string.notification_title_mpd_running,
R.string.notification_text_mpd_running,
R.drawable.notification_icon,
contentIntent);
startForeground(R.string.notification_title_mpd_running, notification); startForeground(R.string.notification_title_mpd_running, notification);
startService(new Intent(this, Main.class)); startService(new Intent(this, Main.class));

View File

@ -743,7 +743,7 @@ MPD_ENABLE_AUTO_PKG_LIB(smbclient, SMBCLIENT, [smbclient >= 0.2],
[smbclient input plugin], [libsmbclient not found]) [smbclient input plugin], [libsmbclient not found])
dnl ----------------------------------- NFS ----------------------------- dnl ----------------------------------- NFS -----------------------------
MPD_ENABLE_AUTO_PKG(nfs, NFS, [libnfs], MPD_ENABLE_AUTO_PKG(nfs, NFS, [libnfs >= 1.9.5],
[NFS input plugin], [libnfs not found]) [NFS input plugin], [libnfs not found])
dnl --------------------------------- Qobuz ----------------------------------- dnl --------------------------------- Qobuz -----------------------------------

View File

@ -47,9 +47,9 @@ NfsConnection::CancellableCallback::Stat(nfs_context *ctx,
{ {
assert(connection.GetEventLoop().IsInside()); assert(connection.GetEventLoop().IsInside());
int result = nfs_stat_async(ctx, path, Callback, this); int result = nfs_stat64_async(ctx, path, Callback, this);
if (result < 0) if (result < 0)
throw FormatRuntimeError("nfs_stat_async() failed: %s", throw FormatRuntimeError("nfs_stat64_async() failed: %s",
nfs_get_error(ctx)); nfs_get_error(ctx));
} }

View File

@ -249,19 +249,19 @@ NfsStorage::MapToRelativeUTF8(const char *uri_utf8) const noexcept
} }
static void static void
Copy(StorageFileInfo &info, const struct stat &st) noexcept Copy(StorageFileInfo &info, const struct nfs_stat_64 &st) noexcept
{ {
if (S_ISREG(st.st_mode)) if (S_ISREG(st.nfs_mode))
info.type = StorageFileInfo::Type::REGULAR; info.type = StorageFileInfo::Type::REGULAR;
else if (S_ISDIR(st.st_mode)) else if (S_ISDIR(st.nfs_mode))
info.type = StorageFileInfo::Type::DIRECTORY; info.type = StorageFileInfo::Type::DIRECTORY;
else else
info.type = StorageFileInfo::Type::OTHER; info.type = StorageFileInfo::Type::OTHER;
info.size = st.st_size; info.size = st.nfs_size;
info.mtime = std::chrono::system_clock::from_time_t(st.st_mtime); info.mtime = std::chrono::system_clock::from_time_t(st.nfs_mtime);
info.device = st.st_dev; info.device = st.nfs_dev;
info.inode = st.st_ino; info.inode = st.nfs_ino;
} }
class NfsGetInfoOperation final : public BlockingNfsOperation { class NfsGetInfoOperation final : public BlockingNfsOperation {
@ -282,7 +282,7 @@ protected:
} }
void HandleResult(gcc_unused unsigned status, void *data) noexcept override { void HandleResult(gcc_unused unsigned status, void *data) noexcept override {
Copy(info, *(const struct stat *)data); Copy(info, *(const struct nfs_stat_64 *)data);
} }
}; };