Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:47:59+00:00 2026-06-04T21:47:59+00:00

I was reading an answer to a different question on SO, in which @RomainGuy

  • 0

I was reading an answer to a different question on SO, in which @RomainGuy commented that one could (please correct me if I’m paraphrasing incorrectly) back-port code from later versions of android to earlier versions. Specifically, I am interested in back-porting code for BitmapRegionDecoder from Android version 2.3.3 (Gingerbread) to version 2.2.2 (Froyo).

I would have rather asked the question more generally as what is the best practice / what should be avoided when back-porting code from newer versions of Android to older versions, but stackoverflow hinted that my question might be closed as being too subjective.

Maybe if there is enough interest in the topic, this question could be “morphed” into a more general one..possibly a community wiki?

In any case, I would appreciate any insight into how this is done..whether specific to my use case, or more general advice. Do calls to native methods from within the java class complicate the matter (necessarily involving the NDK)?

If it is indeed possible (and reasonable) to cherry-pick and back-port code in this way, I think many would find it very useful to know how.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:48:01+00:00Added an answer on June 4, 2026 at 9:48 pm

    As @hackbod mentioned BitmapRegionDecoder is based on external skia library. Yet it’s may be a benefit.

    Let’s examine original source:

    • BitmapRegionDecoder.java. Mostly defines wrappers around native methods:

      private static native Bitmap nativeDecodeRegion(int lbm,
          int start_x, int start_y, int width, int height,
          BitmapFactory.Options options);
      private static native int nativeGetWidth(int lbm);
      private static native int nativeGetHeight(int lbm);
      private static native void nativeClean(int lbm);
      // ...multiply nativeNewInstance overloads follow
      

      Class doesn’t use any new Java APIs we’d need to backport.

    • BitmapRegionDecoder.cpp. Header files it includes consist of ones which are present in Froyo except these two:

      • AutoDecodeCancel.h. The only line it’s used in:

        AutoDecoderCancel   adc(options, decoder);
        

        This class handles SkDecoder instances lifecycle. It’s a small piece of code and may be well back-ported.

      • SkBitmapRegionDecoder.h

        As filename states this is a core component. In fact, all previous were a kind of wrappers around it. The good news is that we may not need to back-port it as it should be possible to take a whole skia library from the Gingerbeard and compile it under Froyo as it is external and doesn’t contain any new dependencies.

    P.S. I didn’t actually dive deep in the code so please correct me if there’s anything I overlooked.

    Update:

    Source code we need is located in following repositories on branches froyo-release and gingerbread-mr4-release:

    • External skia library repository
      • Header files are in include/core and include/images
    • Android framework base
      • Java code: graphics/java/android/graphics/BitmapRegionDecoder.java
      • Native code: core/jni/android/graphics/...
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been reading the answer to a similar question , but I'm still a
Thanks in Advance for reading and answer this question. I got button in asp
After reading Eric Lippert’s answer I got the impression that await and call/cc are
After reading this question , i saw the answer by Naveen containing a link
I was reading over this question and wondered if the accepted answer might also
This question is probably quite different from what you are used to reading here
This is most certainly a language agnostic question and one that has bothered me
I was reading the answer to this question , but it solve the problem
This is kind of a 'double' question that might have a single answer. I'm
I have just started learning C# and would have one question that I cannot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.