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