Skip to content

Commit

Permalink
Cherry pick PR #3988: [android] Move files in dev/cobalt/media to ...…
Browse files Browse the repository at this point in the history
…/coat (#4003)

Refer to the original PR: #3988

Move platform related source code (e.g. CaptionSettings.java,
CobaltMediaSession.java) from dev/cobalt/media to dev/cobalt/coat. There
are no functional changes otherwise.

Some features are mostly used during video playback, like the
MediaSession where the playback control and status is displayed during
playback, are really platform features.

Their implementations were placed in the media/ folder due to legacy
reasons. This PR move them back to the coat folder, where other platform
implementations stay.

b/345542000

---------

Co-authored-by: xiaomings <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and xiaomings authored Aug 17, 2024
1 parent 05e73c4 commit 784189c
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 27 deletions.
12 changes: 6 additions & 6 deletions starboard/android/apk/apk_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
apk_sources = [
"//starboard/android/apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java",
"//starboard/android/apk/app/src/app/java/dev/cobalt/app/MainActivity.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloader.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkDownloaderDefault.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/ArtworkLoader.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/AudioPermissionRequester.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CaptionSettings.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltA11yHelper.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltActivity.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltHttpHelper.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltMediaSession.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltService.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltSystemConfigChangeReceiver.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/CobaltTextToSpeechHelper.java",
Expand All @@ -30,26 +35,21 @@ apk_sources = [
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/KeyboardEditor.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/KeyboardInputConnection.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/MediaPlaybackService.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/MediaImage.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/NetworkStatus.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/NullCobaltFactory.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/PlatformError.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/ResourceOverlay.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfo.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/libraries/services/clientloginfo/ClientLogInfoModule.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/ArtworkDownloader.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/ArtworkDownloaderDefault.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/ArtworkLoader.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioOutputManager.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/AudioTrackBridge.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/CaptionSettings.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/CobaltMediaSession.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/Log.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecCapabilitiesLogger.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecUtil.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaDrmBridge.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaImage.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoFrameReleaseTimeHelper.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceTexture.java",
"//starboard/android/apk/app/src/main/java/dev/cobalt/media/VideoSurfaceView.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import android.app.Activity;
import android.app.Service;
import dev.cobalt.coat.ArtworkDownloaderDefault;
import dev.cobalt.coat.CobaltActivity;
import dev.cobalt.coat.CobaltService;
import dev.cobalt.coat.StarboardBridge;
import dev.cobalt.libraries.services.clientloginfo.ClientLogInfoModule;
import dev.cobalt.media.ArtworkDownloaderDefault;
import dev.cobalt.util.Holder;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

/**
* Interface to download artwork (Bitmap) from a URL, intended for use in media session metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

import static dev.cobalt.media.Log.TAG;
import static dev.cobalt.util.Log.TAG;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

import android.graphics.Bitmap;
import android.os.Handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

import android.view.accessibility.CaptioningManager;
import dev.cobalt.util.UsedByNative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

import static dev.cobalt.media.Log.TAG;
import static dev.cobalt.util.Log.TAG;

import android.app.Activity;
import android.content.Context;
Expand Down Expand Up @@ -50,7 +50,7 @@ public class CobaltMediaSession

private AudioFocusRequest audioFocusRequest;

interface UpdateVolumeListener {
public interface UpdateVolumeListener {
/** Called when there is a change in audio focus. */
void onUpdateVolume(float gain);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
package dev.cobalt.coat;

import dev.cobalt.util.UsedByNative;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.CaptioningManager;
import androidx.annotation.Nullable;
import dev.cobalt.media.ArtworkDownloader;
import dev.cobalt.media.AudioOutputManager;
import dev.cobalt.media.CaptionSettings;
import dev.cobalt.media.CobaltMediaSession;
import dev.cobalt.media.MediaImage;
import dev.cobalt.util.DisplayUtil;
import dev.cobalt.util.Holder;
import dev.cobalt.util.Log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.media.AudioTrack;
import android.os.Build;
import androidx.annotation.RequiresApi;
import dev.cobalt.coat.CobaltMediaSession;
import dev.cobalt.util.Log;
import dev.cobalt.util.UsedByNative;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool SbAccessibilityGetCaptionSettings(

ScopedLocalJavaRef<jobject> j_caption_settings(
env->CallStarboardObjectMethodOrAbort(
"getCaptionSettings", "()Ldev/cobalt/media/CaptionSettings;"));
"getCaptionSettings", "()Ldev/cobalt/coat/CaptionSettings;"));

jfloat font_scale =
env->GetFloatFieldOrAbort(j_caption_settings.Get(), "fontScale", "F");
Expand Down
12 changes: 6 additions & 6 deletions starboard/android/shared/android_media_session_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void OnMediaSessionStateChanged(
if (artwork_count > 0) {
CobaltExtensionMediaImage* artwork(media_metadata->artwork);
ScopedLocalJavaRef<jclass> media_image_class(
env->FindClassExtOrAbort("dev/cobalt/media/MediaImage"));
env->FindClassExtOrAbort("dev/cobalt/coat/MediaImage"));
jmethodID media_image_constructor = env->GetMethodID(
media_image_class.Get(), "<init>",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
Expand Down Expand Up @@ -234,7 +234,7 @@ void OnMediaSessionStateChanged(
env->CallStarboardVoidMethodOrAbort(
"updateMediaSession",
"(IJJFLjava/lang/String;Ljava/lang/String;Ljava/lang/String;"
"[Ldev/cobalt/media/MediaImage;J)V",
"[Ldev/cobalt/coat/MediaImage;J)V",
playback_state, playback_state_actions,
session_state.current_playback_position / kSbTimeMillisecond,
static_cast<jfloat>(session_state.actual_playback_rate), j_title.Get(),
Expand Down Expand Up @@ -290,9 +290,9 @@ const void* GetMediaSessionApi() {
} // namespace starboard

extern "C" SB_EXPORT_PLATFORM void
Java_dev_cobalt_media_CobaltMediaSession_nativeInvokeAction(JNIEnv* env,
jclass unused_clazz,
jlong action,
jlong seek_ms) {
Java_dev_cobalt_coat_CobaltMediaSession_nativeInvokeAction(JNIEnv* env,
jclass unused_clazz,
jlong action,
jlong seek_ms) {
starboard::android::shared::NativeInvokeAction(action, seek_ms);
}

0 comments on commit 784189c

Please sign in to comment.