summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-05-20 11:28:04 -0700
committerJean-Baptiste Queru <jbq@google.com>2009-05-20 11:28:04 -0700
commit843ef36f7b96cc19ea7d2996b7c8661b41ec3452 (patch)
tree560e1648c99a93986f8b7deef851ef8bb8029db7 /include
parent358d23017d0d6c4636eb7599ae7a9b48108899a3 (diff)
downloadframeworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.zip
frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.gz
frameworks_base-843ef36f7b96cc19ea7d2996b7c8661b41ec3452.tar.bz2
donut snapshot
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioRecord.h1
-rw-r--r--include/media/AudioTrack.h1
-rw-r--r--include/media/ToneGenerator.h89
-rw-r--r--include/ui/Camera.h29
-rw-r--r--include/ui/ICameraClient.h9
-rw-r--r--include/utils/ResourceTypes.h275
-rw-r--r--include/utils/backup_helpers.h15
-rw-r--r--include/utils/threads.h7
8 files changed, 304 insertions, 122 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 7164b78..6aa40d00 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -312,7 +312,6 @@ private:
bool processAudioBuffer(const sp<ClientRecordThread>& thread);
- sp<IAudioFlinger> mAudioFlinger;
sp<IAudioRecord> mAudioRecord;
sp<IMemory> mCblkMemory;
sp<ClientRecordThread> mClientRecordThread;
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 7645978..ba0467c 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -383,7 +383,6 @@ private:
bool processAudioBuffer(const sp<AudioTrackThread>& thread);
- sp<IAudioFlinger> mAudioFlinger;
sp<IAudioTrack> mAudioTrack;
sp<IMemory> mCblkMemory;
sp<AudioTrackThread> mAudioTrackThread;
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index ec64e4d..6b0cc8a 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -18,7 +18,7 @@
#define ANDROID_TONEGENERATOR_H_
#include <utils/RefBase.h>
-#include <utils/Vector.h>
+#include <utils/KeyedVector.h>
#include <utils/threads.h>
#include <media/AudioSystem.h>
#include <media/AudioTrack.h>
@@ -49,21 +49,30 @@ public:
TONE_DTMF_C, // C key: 1633Hz, 852Hz
TONE_DTMF_D, // D key: 1633Hz, 941Hz
// Call supervisory tones: 3GPP TS 22.001 (CEPT)
- TONE_SUP_DIAL, // Dial tone: 425Hz, continuous
- TONE_SUP_BUSY, // Busy tone: 425Hz, 500ms ON, 500ms OFF...
- TONE_SUP_CONGESTION, // Congestion tone: 425Hz, 200ms ON, 200ms OFF...
- TONE_SUP_RADIO_ACK, // Radio path acknowlegment: 425Hz, 200ms ON
+ TONE_SUP_DIAL, // Dial tone: CEPT: 425Hz, continuous
+ FIRST_SUP_TONE = TONE_SUP_DIAL,
+ TONE_SUP_BUSY, // Busy tone, CEPT: 425Hz, 500ms ON, 500ms OFF...
+ TONE_SUP_CONGESTION, // Congestion tone CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF...
+ TONE_SUP_RADIO_ACK, // Radio path acknowlegment, CEPT, ANSI: 425Hz, 200ms ON
TONE_SUP_RADIO_NOTAVAIL, // Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts
TONE_SUP_ERROR, // Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF...
- TONE_SUP_CALL_WAITING, // Call Waiting: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
- TONE_SUP_RINGTONE, // Ring Tone: 425Hz, 1s ON, 4s OFF...
+ TONE_SUP_CALL_WAITING, // Call Waiting CEPT,JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
+ TONE_SUP_RINGTONE, // Ring Tone CEPT, JAPAN: 425Hz, 1s ON, 4s OFF...
+ LAST_SUP_TONE = TONE_SUP_RINGTONE,
// Proprietary tones: 3GPP TS 31.111
TONE_PROP_BEEP, // General beep: 400Hz+1200Hz, 35ms ON
TONE_PROP_ACK, // Positive Acknowlgement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
- TONE_PROP_NACK, // Negative Acknowlgement: 300Hz+400Hz+500Hz, 400ms ON
+ TONE_PROP_NACK, // Negative Acknowlgement: 300Hz+400Hz+500Hz, 400ms ON
TONE_PROP_PROMPT, // Prompt tone: 400Hz+1200Hz, 200ms ON
TONE_PROP_BEEP2, // General double beep: 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms on
- NUM_TONES
+ // Additional call supervisory tones: specified by IS-95 only
+ TONE_SUP_INTERCEPT, // Intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms.
+ TONE_SUP_INTERCEPT_ABBREV, // Abbreviated intercept: intercept tone limited to 4 seconds
+ TONE_SUP_CONGESTION_ABBREV, // Abbreviated congestion: congestion tone limited to 4 seconds
+ TONE_SUP_CONFIRM, // Confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle.
+ TONE_SUP_PIP, // Pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off).
+ NUM_TONES,
+ NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1
};
ToneGenerator(int streamType, float volume);
@@ -85,13 +94,45 @@ private:
TONE_RESTARTING //
};
- static const unsigned int TONEGEN_MAX_WAVES = 3;
- static const unsigned int TONEGEN_MAX_SEGMENTS = 4; // Maximun number of elenemts in
+
+ // Region specific tones.
+ // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, rest of the world).
+ // When a tone in the range [FIRST_SUP_TONE, LAST_SUP_TONE] is requested, the region is determined
+ // from system property gsm.operator.iso-country and the proper tone descriptor is selected with the
+ // help of sToneMappingTable[]
+ enum regional_tone_type {
+ // ANSI supervisory tones
+ TONE_ANSI_DIAL = NUM_TONES, // Dial tone: a continuous 350 Hz + 440 Hz tone.
+ TONE_ANSI_BUSY, // Busy tone on: a 480 Hz + 620 Hz tone repeated in a 500 ms on, 500 ms off cycle.
+ TONE_ANSI_CONGESTION, // Network congestion (reorder) tone on: a 480 Hz + 620 Hz tone repeated in a 250 ms on, 250 ms off cycle.
+ TONE_ANSI_CALL_WAITING, // Call waiting tone on: 440 Hz, on for 300 ms, 9,7 s off followed by
+ // (440 Hz, on for 100 ms off for 100 ms, on for 100 ms, 9,7s off and repeated as necessary).
+ TONE_ANSI_RINGTONE, // Ring Tone: a 440 Hz + 480 Hz tone repeated in a 2 s on, 4 s off pattern.
+ // JAPAN Supervisory tones
+ TONE_JAPAN_DIAL, // Dial tone: 400Hz, continuous
+ TONE_JAPAN_BUSY, // Busy tone: 400Hz, 500ms ON, 500ms OFF...
+ TONE_JAPAN_RADIO_ACK, // Radio path acknowlegment: 400Hz, 1s ON, 2s OFF...
+ NUM_ALTERNATE_TONES
+ };
+
+ enum region {
+ ANSI,
+ JAPAN,
+ CEPT,
+ NUM_REGIONS
+ };
+
+ static const unsigned char sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES];
+
+ static const unsigned int TONEGEN_MAX_WAVES = 3; // Maximun number of sine waves in a tone segment
+ static const unsigned int TONEGEN_MAX_SEGMENTS = 5; // Maximun number of segments in a tone descriptor
static const unsigned int TONEGEN_INF = 0xFFFFFFFF; // Represents infinite time duration
static const float TONEGEN_GAIN = 0.9; // Default gain passed to WaveGenerator().
// ToneDescriptor class contains all parameters needed to generate a tone:
- // - The array waveFreq[] contains the frequencies of all individual waves making the multi-tone.
+ // - The array waveFreq[]:
+ // 1 for static tone descriptors: contains the frequencies of all individual waves making the multi-tone.
+ // 2 for active tone descritors: contains the indexes of the WaveGenerator objects in mWaveGens
// The number of sine waves varies from 1 to TONEGEN_MAX_WAVES.
// The first null value indicates that no more waves are needed.
// - The array segments[] is used to generate the tone pulses. A segment is a period of time
@@ -100,17 +141,25 @@ private:
// The data stored in segments[] is the duration of the corresponding period in ms.
// The first segment encountered with a 0 duration indicates that no more segment follows.
// - repeatCnt indicates the number of times the sequence described by segments[] array must be repeated.
- // When the tone generator encounters the first 0 duration segment, it will compare repeatCnt to mCurCount.
- // If mCurCount > repeatCnt, the tone is stopped automatically.
+ // When the tone generator encounters the first 0 duration segment, it will compare repeatCnt to mCurCount.
+ // If mCurCount > repeatCnt, the tone is stopped automatically. Otherwise, tone sequence will be
+ // restarted from segment repeatSegment.
+ // - repeatSegment number of the first repeated segment when repeatCnt is not null
- class ToneDescriptor {
+ class ToneSegment {
public:
+ unsigned int duration;
unsigned short waveFreq[TONEGEN_MAX_WAVES+1];
- unsigned long segments[TONEGEN_MAX_SEGMENTS+1];
+ };
+
+ class ToneDescriptor {
+ public:
+ ToneSegment segments[TONEGEN_MAX_SEGMENTS+1];
unsigned long repeatCnt;
+ unsigned long repeatSegment;
};
- static const ToneDescriptor toneDescriptors[NUM_TONES];
+ static const ToneDescriptor sToneDescriptors[];
unsigned int mTotalSmp; // Total number of audio samples played (gives current time)
unsigned int mNextSegSmp; // Position of next segment transition expressed in samples
@@ -121,6 +170,7 @@ private:
unsigned short mCurSegment; // Current segment index in ToneDescriptor segments[]
unsigned short mCurCount; // Current sequence repeat count
volatile unsigned short mState; // ToneGenerator state (tone_state)
+ unsigned short mRegion;
const ToneDescriptor *mpToneDesc; // pointer to active tone descriptor
const ToneDescriptor *mpNewToneDesc; // pointer to next active tone descriptor
@@ -136,8 +186,9 @@ private:
bool initAudioTrack();
static void audioCallback(int event, void* user, void *info);
bool prepareWave();
- unsigned int numWaves();
+ unsigned int numWaves(unsigned int segmentIdx);
void clearWaveGens();
+ int getToneForRegion(int toneType);
// WaveGenerator generates a single sine wave
class WaveGenerator {
@@ -167,7 +218,7 @@ private:
short mAmplitude_Q15; // Q15 amplitude
};
- Vector<WaveGenerator *> mWaveGens; // list of active wave generators.
+ KeyedVector<unsigned short, WaveGenerator *> mWaveGens; // list of active wave generators.
};
}
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
index e593fea..048bdd5 100644
--- a/include/ui/Camera.h
+++ b/include/ui/Camera.h
@@ -63,6 +63,23 @@ namespace android {
#define FRAME_CALLBACK_FLAG_CAMERA 0x05
#define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07
+// msgType in notifyCallback function
+enum {
+ CAMERA_MSG_ERROR,
+ CAMERA_MSG_SHUTTER,
+ CAMERA_MSG_FOCUS,
+ CAMERA_MSG_ZOOM
+};
+
+// msgType in dataCallback function
+enum {
+ CAMERA_MSG_PREVIEW_FRAME,
+ CAMERA_MSG_VIDEO_FRAME,
+ CAMERA_MSG_POSTVIEW_FRAME,
+ CAMERA_MSG_RAW_IMAGE,
+ CAMERA_MSG_COMPRESSED_IMAGE
+};
+
class ICameraService;
class ICamera;
class Surface;
@@ -78,8 +95,7 @@ class Camera : public BnCameraClient, public IBinder::DeathRecipient
{
public:
// construct a camera client from an existing remote
- Camera(const sp<ICamera>& camera);
-
+ static sp<Camera> create(const sp<ICamera>& camera);
static sp<Camera> connect();
~Camera();
void init();
@@ -137,13 +153,8 @@ public:
void setAutoFocusCallback(autofocus_callback cb, void *cookie);
// ICameraClient interface
- virtual void shutterCallback();
- virtual void rawCallback(const sp<IMemory>& picture);
- virtual void jpegCallback(const sp<IMemory>& picture);
- virtual void previewCallback(const sp<IMemory>& frame);
- virtual void errorCallback(status_t error);
- virtual void autoFocusCallback(bool focused);
- virtual void recordingCallback(const sp<IMemory>& frame);
+ virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
+ virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr);
sp<ICamera> remote();
diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h
index 73b951c..c4bdd07 100644
--- a/include/ui/ICameraClient.h
+++ b/include/ui/ICameraClient.h
@@ -29,13 +29,8 @@ class ICameraClient: public IInterface
public:
DECLARE_META_INTERFACE(CameraClient);
- virtual void shutterCallback() = 0;
- virtual void rawCallback(const sp<IMemory>& picture) = 0;
- virtual void jpegCallback(const sp<IMemory>& picture) = 0;
- virtual void previewCallback(const sp<IMemory>& frame) = 0;
- virtual void errorCallback(status_t error) = 0;
- virtual void autoFocusCallback(bool focused) = 0;
- virtual void recordingCallback(const sp<IMemory>& frame) = 0;
+ virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
+ virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0;
};
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index d01d83f..9b8c302 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -988,119 +988,225 @@ struct ResTable_config
return diffs;
}
- // Return true if 'this' is more specific than 'o'. Optionally, if
- // 'requested' is null, then they will also be compared against the
- // requested configuration and true will only be returned if 'this'
- // is a better candidate than 'o' for the configuration. This assumes that
- // match() has already been used to remove any configurations that don't
- // match the requested configuration at all; if they are not first filtered,
- // non-matching results can be considered better than matching ones.
+ // Return true if 'this' is more specific than 'o'.
inline bool
- isBetterThan(const ResTable_config& o, const ResTable_config* requested = NULL) const {
+ isMoreSpecificThan(const ResTable_config& o) const {
// The order of the following tests defines the importance of one
// configuration parameter over another. Those tests first are more
// important, trumping any values in those following them.
- if (imsi != 0 && (!requested || requested->imsi != 0)) {
- if (mcc != 0 && (!requested || requested->mcc != 0)) {
- if (o.mcc == 0) {
- return true;
- }
+ if (imsi || o.imsi) {
+ if (mcc != o.mcc) {
+ if (!mcc) return false;
+ if (!o.mcc) return true;
}
- if (mnc != 0 && (!requested || requested->mnc != 0)) {
- if (o.mnc == 0) {
- return true;
- }
+
+ if (mnc != o.mnc) {
+ if (!mnc) return false;
+ if (!o.mnc) return true;
}
}
- if (locale != 0 && (!requested || requested->locale != 0)) {
- if (language[0] != 0 && (!requested || requested->language[0] != 0)) {
- if (o.language[0] == 0) {
- return true;
- }
+
+ if (locale || o.locale) {
+ if (language[0] != o.language[0]) {
+ if (!language[0]) return false;
+ if (!o.language[0]) return true;
}
- if (country[0] != 0 && (!requested || requested->country[0] != 0)) {
- if (o.country[0] == 0) {
- return true;
- }
+
+ if (country[0] != o.country[0]) {
+ if (!country[0]) return false;
+ if (!o.country[0]) return true;
}
}
- if (screenType != 0 && (!requested || requested->screenType != 0)) {
- if (orientation != 0 && (!requested || requested->orientation != 0)) {
- if (o.orientation == 0) {
- return true;
- }
+
+ if (screenType || o.screenType) {
+ if (orientation != o.orientation) {
+ if (!orientation) return false;
+ if (!o.orientation) return true;
}
- if (density != 0 && (!requested || requested->density != 0)) {
- if (o.density == 0) {
- return true;
- }
+
+ // density is never 'more specific'
+ // as the default just equals 160
+
+ if (touchscreen != o.touchscreen) {
+ if (!touchscreen) return false;
+ if (!o.touchscreen) return true;
}
- if (touchscreen != 0 && (!requested || requested->touchscreen != 0)) {
- if (o.touchscreen == 0) {
- return true;
- }
+ }
+
+ if (input || o.input) {
+ if (inputFlags != o.inputFlags) {
+ if (!(inputFlags & MASK_KEYSHIDDEN)) return false;
+ if (!(o.inputFlags & MASK_KEYSHIDDEN)) return true;
+ }
+
+ if (keyboard != o.keyboard) {
+ if (!keyboard) return false;
+ if (!o.keyboard) return true;
+ }
+
+ if (navigation != o.navigation) {
+ if (!navigation) return false;
+ if (!o.navigation) return true;
}
}
- if (input != 0 && (!requested || requested->input != 0)) {
- const int keysHidden = inputFlags&MASK_KEYSHIDDEN;
- const int reqKeysHidden = requested
- ? requested->inputFlags&MASK_KEYSHIDDEN : 0;
- if (keysHidden != 0 && reqKeysHidden != 0) {
- const int oKeysHidden = o.inputFlags&MASK_KEYSHIDDEN;
- //LOGI("isBetterThan keysHidden: cur=%d, given=%d, config=%d\n",
- // keysHidden, oKeysHidden, reqKeysHidden);
- if (oKeysHidden == 0) {
- //LOGI("Better because 0!");
- return true;
+
+ if (screenSize || o.screenSize) {
+ if (screenWidth != o.screenWidth) {
+ if (!screenWidth) return false;
+ if (!o.screenWidth) return true;
+ }
+
+ if (screenHeight != o.screenHeight) {
+ if (!screenHeight) return false;
+ if (!o.screenHeight) return true;
+ }
+ }
+
+ if (version || o.version) {
+ if (sdkVersion != o.sdkVersion) {
+ if (!sdkVersion) return false;
+ if (!o.sdkVersion) return true;
+ }
+
+ if (minorVersion != o.minorVersion) {
+ if (!minorVersion) return false;
+ if (!o.minorVersion) return true;
+ }
+ }
+ return false;
+ }
+
+ // Return true if 'this' is a better match than 'o' for the 'requested'
+ // configuration. This assumes that match() has already been used to
+ // remove any configurations that don't match the requested configuration
+ // at all; if they are not first filtered, non-matching results can be
+ // considered better than matching ones.
+ // The general rule per attribute: if the request cares about an attribute
+ // (it normally does), if the two (this and o) are equal it's a tie. If
+ // they are not equal then one must be generic because only generic and
+ // '==requested' will pass the match() call. So if this is not generic,
+ // it wins. If this IS generic, o wins (return false).
+ inline bool
+ isBetterThan(const ResTable_config& o,
+ const ResTable_config* requested) const {
+ if (requested) {
+ if (imsi || o.imsi) {
+ if ((mcc != o.mcc) && requested->mcc) {
+ return (mcc);
}
- // For compatibility, we count KEYSHIDDEN_NO as being
- // the same as KEYSHIDDEN_SOFT. Here we disambiguate these
- // may making an exact match more specific.
- if (keysHidden == reqKeysHidden && oKeysHidden != reqKeysHidden) {
- // The current configuration is an exact match, and
- // the given one is not, so the current one is better.
- //LOGI("Better because other not same!");
- return true;
+
+ if ((mnc != o.mnc) && requested->mnc) {
+ return (mnc);
}
}
- if (keyboard != 0 && (!requested || requested->keyboard != 0)) {
- if (o.keyboard == 0) {
- return true;
+
+ if (locale || o.locale) {
+ if ((language[0] != o.language[0]) && requested->language[0]) {
+ return (language[0]);
}
- }
- if (navigation != 0 && (!requested || requested->navigation != 0)) {
- if (o.navigation == 0) {
- return true;
+
+ if ((country[0] != o.country[0]) && requested->country[0]) {
+ return (country[0]);
}
}
- }
- if (screenSize != 0 && (!requested || requested->screenSize != 0)) {
- if (screenWidth != 0 && (!requested || requested->screenWidth != 0)) {
- if (o.screenWidth == 0) {
- return true;
+
+ if (screenType || o.screenType) {
+ if ((orientation != o.orientation) && requested->orientation) {
+ return (orientation);
+ }
+
+ if (density != o.density) {
+ // density is tough. Any density is potentially useful
+ // because the system will scale it. Scaling down
+ // is generally better than scaling up.
+ // Default density counts as 160dpi (the system default)
+ // TODO - remove 160 constants
+ int h = (density?density:160);
+ int l = (o.density?o.density:160);
+ bool bImBigger = true;
+ if (l > h) {
+ int t = h;
+ h = l;
+ l = t;
+ bImBigger = false;
+ }
+
+ int reqValue = (requested->density?requested->density:160);
+ if (reqValue >= h) {
+ // requested value higher than both l and h, give h
+ return bImBigger;
+ }
+ if (l >= reqValue) {
+ // requested value lower than both l and h, give l
+ return !bImBigger;
+ }
+ // saying that scaling down is 2x better than up
+ if (((2 * l) - reqValue) * h > reqValue * reqValue) {
+ return !bImBigger;
+ } else {
+ return bImBigger;
+ }
+ }
+
+ if ((touchscreen != o.touchscreen) && requested->touchscreen) {
+ return (touchscreen);
}
}
- if (screenHeight != 0 && (!requested || requested->screenHeight != 0)) {
- if (o.screenHeight == 0) {
- return true;
+
+ if (input || o.input) {
+ const int keysHidden = inputFlags & MASK_KEYSHIDDEN;
+ const int oKeysHidden = o.inputFlags & MASK_KEYSHIDDEN;
+ if (keysHidden != oKeysHidden) {
+ const int reqKeysHidden =
+ requested->inputFlags & MASK_KEYSHIDDEN;
+ if (reqKeysHidden) {
+
+ if (!keysHidden) return false;
+ if (!oKeysHidden) return true;
+ // For compatibility, we count KEYSHIDDEN_NO as being
+ // the same as KEYSHIDDEN_SOFT. Here we disambiguate
+ // these by making an exact match more specific.
+ if (reqKeysHidden == keysHidden) return true;
+ if (reqKeysHidden == oKeysHidden) return false;
+ }
+ }
+
+ if ((keyboard != o.keyboard) && requested->keyboard) {
+ return (keyboard);
+ }
+
+ if ((navigation != o.navigation) && requested->navigation) {
+ return (navigation);
}
}
- }
- if (version != 0 && (!requested || requested->version != 0)) {
- if (sdkVersion != 0 && (!requested || requested->sdkVersion != 0)) {
- if (o.sdkVersion == 0) {
- return true;
+
+ if (screenSize || o.screenSize) {
+ if ((screenWidth != o.screenWidth) && requested->screenWidth) {
+ return (screenWidth);
+ }
+
+ if ((screenHeight != o.screenHeight) &&
+ requested->screenHeight) {
+ return (screenHeight);
}
}
- if (minorVersion != 0 && (!requested || requested->minorVersion != 0)) {
- if (o.minorVersion == 0) {
- return true;
+
+ if (version || o.version) {
+ if ((sdkVersion != o.sdkVersion) && requested->sdkVersion) {
+ return (sdkVersion);
+ }
+
+ if ((minorVersion != o.minorVersion) &&
+ requested->minorVersion) {
+ return (minorVersion);
}
}
+
+ return false;
}
- return false;
+ return isMoreSpecificThan(o);
}
-
+
// Return true if 'this' can be considered a match for the parameters in
// 'settings'.
// Note this is asymetric. A default piece of data will match every request
@@ -1137,8 +1243,7 @@ struct ResTable_config
&& orientation != settings.orientation) {
return false;
}
- // Density not taken into account, always match, no matter what
- // density is specified for the resource
+ // density always matches - we can scale it. See isBetterThan
if (settings.touchscreen != 0 && touchscreen != 0
&& touchscreen != settings.touchscreen) {
return false;
diff --git a/include/utils/backup_helpers.h b/include/utils/backup_helpers.h
new file mode 100644
index 0000000..137c5f1
--- /dev/null
+++ b/include/utils/backup_helpers.h
@@ -0,0 +1,15 @@
+#ifndef _UTILS_BACKUP_HELPERS_H
+#define _UTILS_BACKUP_HELPERS_H
+
+int back_up_files(int oldSnapshotFD, int oldDataStream, int newSnapshotFD,
+ char const* fileBase, char const* const* files, int fileCount);
+
+#define TEST_BACKUP_HELPERS 0
+
+#if TEST_BACKUP_HELPERS
+int backup_helper_test_empty();
+int backup_helper_test_four();
+int backup_helper_test_files();
+#endif
+
+#endif // _UTILS_BACKUP_HELPERS_H
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 8d8d46a..b320915 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -79,6 +79,13 @@ enum {
ANDROID_PRIORITY_LESS_FAVORABLE = +1,
};
+enum {
+ ANDROID_TGROUP_DEFAULT = 0,
+ ANDROID_TGROUP_BG_NONINTERACT = 1,
+ ANDROID_TGROUP_FG_BOOST = 2,
+ ANDROID_TGROUP_MAX = ANDROID_TGROUP_FG_BOOST,
+};
+
// Create and run a new thread.
extern int androidCreateThread(android_thread_func_t, void *);