Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ArtworkDownloader interface #3707

Merged
merged 1 commit into from
Jun 28, 2024
Merged

Add ArtworkDownloader interface #3707

merged 1 commit into from
Jun 28, 2024

Conversation

zhongqiliang
Copy link
Contributor

Extract and refactor the part of the code in ArtworkLoader to a new interface ArtworkDownloader and its default implementation ArtworkDownloaderDefault, so that we could swap the implementation in Kimono to avoid GMS Extract the artwork downloading functionality from ArtworkLoader into a separate interface (ArtworkDownloader) and a default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d

@kaidokert
Copy link
Member

This seems like a good way to abstract this, but have you considered generalizing CobaltHttpHelper interface instead ? So that we can swap out that implementation for all uses of java.net.URLHttpConnection with a single module ?

@datadog-cobalt-youtube
Copy link

datadog-cobalt-youtube bot commented Jun 27, 2024

Datadog Report

Branch report: artwork_downloader
Commit report: 23601c0
Test service: cobalt

✅ 0 Failed, 34428 Passed, 6 Skipped, 9m 15.25s Total Time

@zhongqiliang
Copy link
Contributor Author

These are all Java changes, all failed c++ tests should be flaky.

@zhongqiliang
Copy link
Contributor Author

zhongqiliang commented Jun 27, 2024

The CobaltHttpHelper is a utility customized for the DRM provisioning. I do not see an easy way to combine it with the ArtworkDownloader.

The best thing I can do is to combine these 2 things into 1 interface, something like.
public interface HttpClientUtil {
public Bitmap downloadArtwork(String url);
public byte[] performDrmHttpPost(String url);
}

I felt this is probably not better than split, e.g add this interface on top of what we have
public interface DRMProvisioningUtil {
public byte[] performDrmHttpPost(String url);
}
This way, we can speed up the process to fix the GMS kill app issue on prod.

How about we submit this first, then follow up with the DRM fix in 2 weeks?

@kaidokert
Copy link
Member

How about we submit this first, then follow up with the DRM fix in 2 weeks?

That's fine. I'd go ahead and make it a re-factor so that the CobaltHttpHelper doesn't implement specific HTTP work ( e.g. artwork or drm ) but be a general helper for making a HTTP POST or GET request, with the logic for specifying Artwork or DRM arguments and payloads in their original modules.

@zhongqiliang zhongqiliang enabled auto-merge (squash) June 28, 2024 17:46
auto-merge was automatically disabled June 28, 2024 17:51

Pull Request is not mergeable

@zhongqiliang zhongqiliang enabled auto-merge (squash) June 28, 2024 20:13
Extract and refactor the part of the code in ArtworkLoader to a new
interface ArtworkDownloader and its default implementation
ArtworkDownloaderDefault, so that we could swap the implementation
in Kimono to avoid GMS Extract the artwork downloading
functionality from ArtworkLoader into a separate interface
(ArtworkDownloader) and a default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to
provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d
auto-merge was automatically disabled June 28, 2024 22:15

Pull Request is not mergeable

@zhongqiliang zhongqiliang enabled auto-merge (squash) June 28, 2024 22:56
@zhongqiliang zhongqiliang merged commit 1f75c29 into main Jun 28, 2024
315 of 318 checks passed
@zhongqiliang zhongqiliang deleted the artwork_downloader branch June 28, 2024 23:23
@zhongqiliang zhongqiliang added cp-24.lts.1+ Cherry Pick to the 24.lts.1+ branch cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch labels Jun 28, 2024
cobalt-github-releaser-bot pushed a commit that referenced this pull request Jun 28, 2024
Extract and refactor the part of the code in ArtworkLoader to a new
interface ArtworkDownloader and its default implementation
ArtworkDownloaderDefault, so that we could swap the implementation in
Kimono to avoid GMS Extract the artwork downloading functionality from
ArtworkLoader into a separate interface (ArtworkDownloader) and a
default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to
provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d

Co-authored-by: Colin Liang <colinliang@google.com>
(cherry picked from commit 1f75c29)
cobalt-github-releaser-bot pushed a commit that referenced this pull request Jun 28, 2024
Extract and refactor the part of the code in ArtworkLoader to a new
interface ArtworkDownloader and its default implementation
ArtworkDownloaderDefault, so that we could swap the implementation in
Kimono to avoid GMS Extract the artwork downloading functionality from
ArtworkLoader into a separate interface (ArtworkDownloader) and a
default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to
provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d

Co-authored-by: Colin Liang <colinliang@google.com>
(cherry picked from commit 1f75c29)
zhongqiliang added a commit that referenced this pull request Jul 1, 2024
Refer to the original PR: #3707

Extract and refactor the part of the code in ArtworkLoader to a new
interface ArtworkDownloader and its default implementation
ArtworkDownloaderDefault, so that we could swap the implementation in
Kimono to avoid GMS Extract the artwork downloading functionality from
ArtworkLoader into a separate interface (ArtworkDownloader) and a
default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to
provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d

Co-authored-by: Colin Liang <zhongqi.liang.4u@gmail.com>
kaidokert pushed a commit that referenced this pull request Jul 1, 2024
Refer to the original PR: #3707

Extract and refactor the part of the code in ArtworkLoader to a new
interface ArtworkDownloader and its default implementation
ArtworkDownloaderDefault, so that we could swap the implementation in
Kimono to avoid GMS Extract the artwork downloading functionality from
ArtworkLoader into a separate interface (ArtworkDownloader) and a
default implementation
(ArtworkDownloaderDefault). This will allow the Kimono project to
provide its own implementation without relying on GMS dependencies.

b/347963541

Change-Id: I7edd475991c7dd755aa24f313aaa890db4d5798d

Co-authored-by: Colin Liang <zhongqi.liang.4u@gmail.com>
// See the License for the specific language governing permissions and
// limitations under the License.

package dev.cobalt.media;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to double check if we need to add this file to "apk_sources.gni".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to add the new files in the gni file, thanks for pointing this out.

zhongqiliang pushed a commit that referenced this pull request Aug 13, 2024
The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a
xiaomings pushed a commit that referenced this pull request Aug 13, 2024
The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a

Co-authored-by: Colin Liang <colinliang@google.com>
cobalt-github-releaser-bot pushed a commit that referenced this pull request Aug 13, 2024
The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a

Co-authored-by: Colin Liang <colinliang@google.com>
(cherry picked from commit 6eaa15d)
cobalt-github-releaser-bot pushed a commit that referenced this pull request Aug 13, 2024
The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a

Co-authored-by: Colin Liang <colinliang@google.com>
(cherry picked from commit 6eaa15d)
zhongqiliang added a commit that referenced this pull request Aug 14, 2024
Refer to the original PR: #3983

The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a

Co-authored-by: Colin Liang <zhongqi.liang.4u@gmail.com>
kaidokert pushed a commit that referenced this pull request Aug 15, 2024
Refer to the original PR: #3983

The files were added in #3707

b/347963541

Change-Id: Ibab302808d5373759606898bf4c451385aed400a

Co-authored-by: Colin Liang <zhongqi.liang.4u@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cp-24.lts.1+ Cherry Pick to the 24.lts.1+ branch cp-25.lts.1+ Cherry Pick to the 25.lts.1+ branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants