1# This script is used to pull the most up-to-date files from
2# Gallery into Launcher (we use some code from the Gallery
3# source). The Launcher versions have some small modifications
4# so do this with care, and be sure you are pulling from the
5# latest version of Gallery
6import os
7import sys
8files = """
9src/android/util/Pools.java
10src/com/android/gallery3d/util/IntArray.java
11src/com/android/gallery3d/common/Utils.java
12src/com/android/gallery3d/exif/ByteBufferInputStream.java
13src/com/android/gallery3d/exif/CountedDataInputStream.java
14src/com/android/gallery3d/exif/ExifData.java
15src/com/android/gallery3d/exif/ExifInterface.java
16src/com/android/gallery3d/exif/ExifInvalidFormatException.java
17src/com/android/gallery3d/exif/ExifModifier.java
18src/com/android/gallery3d/exif/ExifOutputStream.java
19src/com/android/gallery3d/exif/ExifParser.java
20src/com/android/gallery3d/exif/ExifReader.java
21src/com/android/gallery3d/exif/ExifTag.java
22src/com/android/gallery3d/exif/IfdData.java
23src/com/android/gallery3d/exif/IfdId.java
24src/com/android/gallery3d/exif/JpegHeader.java
25src/com/android/gallery3d/exif/OrderedDataOutputStream.java
26src/com/android/gallery3d/exif/Rational.java
27src/com/android/gallery3d/glrenderer/BasicTexture.java
28src/com/android/gallery3d/glrenderer/BitmapTexture.java
29src/com/android/gallery3d/glrenderer/GLCanvas.java
30src/com/android/gallery3d/glrenderer/GLES20Canvas.java
31src/com/android/gallery3d/glrenderer/GLES20IdImpl.java
32src/com/android/gallery3d/glrenderer/GLId.java
33src/com/android/gallery3d/glrenderer/GLPaint.java
34src/com/android/gallery3d/glrenderer/RawTexture.java
35src/com/android/gallery3d/glrenderer/Texture.java
36src/com/android/gallery3d/glrenderer/UploadedTexture.java
37src/com/android/photos/BitmapRegionTileSource.java
38src/com/android/photos/views/BlockingGLTextureView.java
39src/com/android/photos/views/TiledImageRenderer.java
40src/com/android/photos/views/TiledImageView.java
41src/com/android/gallery3d/common/BitmapUtils.java
42"""
43
44if len(sys.argv) != 2:
45    print "Usage: python update_gallery_files.py <gallery_dir>"
46    exit()
47gallery_dir = sys.argv[1]
48for file_path in files.split():
49    dir = os.path.dirname(file_path)
50    if file_path.find('exif') != -1 or file_path.find('common') != -1:
51        file_path = 'gallerycommon/' + file_path
52    cmd = 'cp %s/%s WallpaperPicker/%s/' % (gallery_dir, file_path, dir)
53    print cmd
54    os.system(cmd)
55